Adding Vars To A Sql

free web hosting
Free Web Hosting > Computers & Tech > Programming > Programming General > SQL (Structured Query Language)

Adding Vars To A Sql

sparkx
Well I have been recieving some real good help here at astahost so I decited I just won't even try Yahoo Answers first. OK this is halfway between php and mysql. I want to echo text from MySQL that includes vars. Here is an example:
MySQL Entry
CODE
This is some sql entry. $var

I tryied:
CODE
$var=("It worked");
$row = mysql_fetch_array(mysql_query("SELECT * FROM example WHERE id='5'"));
$output=$row['content'];
echo($output);//Doesnt work
echo<<<END
$output
END;//Still doesnt work

My wanted outcome:
CODE
This is some sql entry. It worked

Do you understand what I am saying? Im sorry but I think I stated the question well.
 Thank you all very much for all the help,
Sparkx

 

 

 


Reply

pyost
With just some minor modifications, it should work. Here's how I would do it.

CODE
$var = 'It worked';
$row = mysql_fetch_array(mysql_query('SELECT * FROM example WHERE id=5'));
$output = $row['content'] . $var;
echo $output;


1. No parenthesis
2. If the ID field is numerical, there is no need for quotes
3. Besides the data extracted from the database, we need to output the variable, too
4. Again, no parenthesis

I've also used single quotes instead of double quotes - both are possible, but it's just a habit smile.gif

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : adding, vars, sql

  1. Adding Element To Page Issues
    (0)
  2. Problems Dynamically Adding A Table With Dom
    (4)
    I'm writing a search function to search a MySQL database I have. The search uses AJAX with a
    php server to search the database and generate a result. The result is passed back as a DOM object
    to the javascript, which then parses the result into an xhtml table. I then add the table to my
    page. This works just fine under Firefox. However, under IE (version 7, so I assume others as
    well), the table doesn't display. I used the IE Developer Toolbar to look at the DOM, and the
    table has been successfully added to the DOM, but it isn't showing up. Interesting....
  3. Adding Security Enhancements To Php Programs
    Security enhancements of PHP programs (0)
    PHP is becoming the language for even general programming more as it has seen from PHP4 to PHP5. PHP
    originally started as CGI script language connected with the internet. Thus, PHP is closely related
    with the internet and security - whether the problem comes from security leak point of internet
    protocols or not - problems related to the internet. There are two major security issues when your
    PHP program(s) has something to do with the internet. There can be memory leak and security leak
    from the program of PHP not connected - or connected - to the internet by PHP settin....
  4. Adding Subdomains With cPanel
    (6)
    I just add for the first time a new subdomain to my account with the cPanel and it is very easy as
    simple insert the name and submit, how can i setup the default folder of this new subdomain???
    because I want to assign this to a different folder or i just copy all the files to this default
    folder. Best regards,....
  5. How To Add Spf Records For My Domain
    Modifying/Adding MX records in cpanel (0)
    Well, I was interested in adding SPF ( Sender Policy Framework ) records for my domain in order to
    do my part in reducing SPAM. (This?) CPanel only has a single box for the mail exchanger rather than
    allowing one to add a record. Is there some way to do this? When I was on the other side of the
    hosting biz, I remember being able to add arbitrary DNS records from within CPanel.....
  6. Php :: Adding Image Over Image
    (5)
    Hi Masters & Champions. I want some help regarding putting and image over some location (x pixel ,
    y pixel) of an image. Here it is quite important to note that the mage which is Inserted over an
    image must be clickable. Like for example suppose i put T on an image DD then the T must be
    clickable. Please gudie as this is quite important for me . Thanks ....
  7. Php Question Re Adding A Link
    inside a top frame (2)
    I have a directory site that someone else programmed for me a couple of years ago. I have been
    making my own modifications to the script, and generally not running into many issues, since the
    changes are usually pretty basic. When a visitor clicks on a category, it takes them to a category
    page which lists all the sub categories, and under each category is a list of the links in it. When
    you click on one of the links, it takes you to a frame page. I have a tiny frame across the top
    which allows them to stay within the site. (Q) I would like to add a tiny link in my ....
  8. Adding Google Adsense
    (6)
    i'm using a program to build my website, so i dunno how to add the google adsense once i upload
    my website, or a more accurate thing would be i dunno where to add it to the html coding...anyone
    knows?!....
  9. Friend Networking Script... Help!
    Adding & removing friends (1)
    I'm creating my own friend network script which is going to be a combo of MySpace/Facebook and
    an AIM profile. One of the most important features is the adding of friends. The way to do this is
    probably simple & I'll kick myself when I see the code to do it. What needs to happen is a
    friend clicks a link which sends an internal message through the scripts messaging system (like a PM
    on a forum) to the other person to approve or deny the request. In that message, there needs to be a
    link to a page which executes a PHP script which updates the database adding b....
  10. Help: Adding My Videos Folder To Start Menu
    Windows XP Only (10)
    Okay, I am halfway to being able to add the My Videos Folder (the only of the special My folder I
    really use) to the start panel. For those of you who don't know what I am talking about, make
    sure you have the new XP start menu not classic, then open your start menu. The right side is the
    start panel, and it should have links to things like My Documents, My Music, My Computer, etc. The
    only one you can't add to it (you add features to it from the properties page) is the My Videos
    File. No, my method: 1) Knowing Windows as well as I do, first thing after ex....
  11. Add A Forum To Your Site
    A guide to adding discussion forums to your site (23)
    QUOTE When you’re setting up a site using CSS, it’s a good idea to do a little planning ahead
    and think how you’ll be using your styles, otherwise you could end up spending much more time later.
    As a case in point – for a site I’ve recently built, a basic style sheet was put together, with
    entries for matters like headlines, section headings, item headings and so on. When it came to forms
    on the site that needed headings next to the data entry boxes, the logical choice was the item
    headings style. It helped maintain a consistent look across the site, but it came bac....
  12. Need Help adding music to a webpage
    How to get music onto a webpage (9)
    I NEED HELP ON PUTTING MUSIC ON MY WEBSITE!!! THE MUSIC CANNOT BE LOCATED ON MP3
    DOWNLOADS !!! Man /sad.gif" style="vertical-align:middle" emoid=":(" border="0"
    alt="sad.gif" /> I downloaded the music on my limewire now i have to figure out how the hell am i
    going to get this mp3 song to a website so i can play as bgsound (example:
    www.figuremusic.com/song/pwnage.mp3) i need a website where i can like make my music into a
    website.. its confusing for me to explain........ i need a website where i can like post a music
    file and if people wants to ....
  13. Need Help With Adding Nvidia Drivers In Debian
    please help! (3)
    Ok, I decided to go with Debian because I've always wanted to try it. I'm using the latest
    version and I just need to get the drivers installed. I've searched and searched, but I
    can't figure out how to login as root and execute commands in the terminal as root. I USED to
    know, like a really long time ago, but I can no longer find my old documents that I had printed out
    with the command. Perhaps one of our kind Linux users would like to assist a noob to Linux?
    /tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> I'....
  14. Need Help Is Adding A PHP Based News Module To My Site
    (2)
    Hey guys i need a simple help i'm builing a homesite and i have a little spot for news. Well i
    just place there the Topics and add a link to another page "news.php". Well its obvious that i dont
    want to build a file for each news that i have so i know that exists a way to work with SQL & PHP. I
    will show want i'm doing CODE <?php        require ('mysql.php');
           $query="SELECT * FROM News ORDER BY `data` ASC LIMIT 0,5 ";       
    $result=mysql_query($query);            $num=mysql_num_rows&#....
  15. Adding Static Content To Website...
    (9)
    I want to add some static content to my website and was steering towards using SHTML files and the
    #include method, but hesitated on it. I currently have a big handful of .HTM files and don't
    want to convert them to SHTML (even though it shouldn't be much of a bother). I just like them
    to be .HTM files (use to it). Is there any way to do something similar like the Server Side Include
    method above, but with HTM files instead? Usually the SHTML code will have some line like the below
    in it: QUOTE <!--#include virtual="mypage.html" --> So if I j....
  16. Adding Search Feature To My Site
    (0)
    Hi, I'm looking for a script to add to my website. Either Perl/CGI or PHP will do. Just need
    to find one that's easy to customize. I looked around and found some but had problems with
    them. I have Google Search already but it's not exactly searching my whole site (probably
    because it didn't cache it yet). So I will most likely remove that search feature and add a
    better one that will do a more thorough search. Just a few things to mention. I read about this on
    one of the search script sites. So if anyone know of some search scripts that have these....
  17. Adding More IDE Ports In Computer
    (17)
    Hi, is there any way I can add more IDE ports to my computer? I'm building a computer from
    scratch and it's basically done. Just want to know how I can add more IDE ports since I plan on
    adding multiple hard drives to this computer and with the current setup, there will be no more free
    IDE ports. I did some searching before posting here and found some users mentioning a PCI IDE
    Controller card. I searched online and all I found are ATA/SATA/RAID Controller Cards instead. Are
    these the same? I know I had to use a controller card on my older Windows 98 deskto....
  18. Adding East Asian Fonts To Your System
    For Windows XP (4)
    While trying to show someone the mysterious symbols used to create "The Matrix" source code, I
    realized that most people have no need to use the East Asian input services offered in Windows XP
    but they still may want to know how to play with the options. Additionally, there may be many
    Eur-Asian people throughout the world that don't know that they can use their native language
    when sending emails to their families abroad;. Or even type letters in their native script. Well,
    in an effort to increase the public knowledge of this service, I decided to write this tuto....
  19. Photoshop Tutorial: Adding Color That Wasn't There
    to a Black and White Picture (4)
    Taking a note from my previous tutorial, here's how to have color in a black and white picture
    that may not have been there to begin with. 1. Take any graphic you want; the simpler, the better.
    2. Go to the Layers tab, right click, and choose Duplicate Layer (You'll get a message
    asking what you want to name the layer and where you want it. Just press OK to go with the default.)
    3. Go to the Image Section in the top area, select Adjustments, then Desaturate. 4. You now
    have two choices- Background and Background Copy...click on Background to go back....
  20. Photoshop Tutorial: Adding Color To Black And White Photo
    A little splash on an otherwise b&w pic (5)
    Okay, quick, easy tutorial about how to get color on a black and white graphic. I will be using
    Photoshop CS, but I think you can find many of the same things in version 7. 1. Take any graphic
    you want; the simpler, the better. 2. Go to the Layers tab, right click, and choose Duplicate Layer
    (You'll get a message asking what you want to name the layer and where you want it. Just
    press OK to go with the default.) 3. Go to the Image Section in the top area, select Adjustments,
    then Desaturate. 4. Now, here's what my graphic looks like so far: 5.....
  21. Adding Comma To End Of Line & Concatenating Lines
    (4)
    I have a huge word document that I want to be able to add a comma to the end of each line and then
    concatenate the whole document together. For example: test testing 1 test 23 4 I want that to
    be something like: test,testing 1,test 23 4 I tried doing this using a macro (not very good at),
    but couldn't get them to come out right. Basically I want to make sure that each line connects
    to the previous one followed by a comma at the end. My document so far has over 4,300 lines now and
    growing. Any VBA experts out there or does anyone else know of an easier way....
  22. How To Add A Film Edge To Your Photos
    Adding a film edge (1)
    Hey everyone, Okay, so you have seen those cool photos in the magazines that have a nice film edge
    on the side and now you want to make one too. Well here's how. You will need the following
    1.) A piece of film 2.) A scanner 3.) Photoshop (the best program ever) First take the negative and
    place it in your scanner and scan the film at the highest resolution Once you have done this save
    the file in whatever format you desire (.jpeg to save space or .tiff if you want quality) Next open
    up the file in photoshop Using the crop tool cut out the unecessary space. Yo....
  23. Fedora 3: Trying To Setup Ftp/http Server
    Adding users problem (2)
    I am helping on developing an Intranet for my school. We have a server with Fedora Core 3 installed
    and Apache. I got FTP working too but root access is denied as default. But we have a problem. We
    would like users to be able to have accounts for their pages, but we don't want to give root FTP
    access. When we go to http://SERVERIP/~account , we get an access denied page. Anyone have any
    tips? Thanks! F....
  24. Adding Ttf Fonts To Your Linux
    so you can really get into gimping :) (0)
    Using ttf fonts in Linux While working in Linux and wanting to work with the GIMP, I mainly
    lacked my fonts, the ones I had in Windows, so needless to say I had to fix this. So here is how I
    do it /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> First you will
    have to make a folder to store your ttf fonts in, normally I use /usr/share/fonts/ttf/ as folder.
    You will have to do this as root, so su - (password) mkdir /usr/share/fonts/ttf/ chmod 755
    /usr/share/fonts/tff What we did here, was with "su -" change the user to root, the "-" just ....
  25. Adding A Windows Media Player
    HTML coding for adding this player (0)
    width=320 height=302 type=application/x-mplayer2 ShowC.?1? ShowStatusBar="1" AutoSize="true"
    EnableC.?0? DisplaySize="0"> hopefully that can help anyone who wishes to add one of these to
    their site /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> ....
  26. Help
    Adding a online application to a website (4)
    Does anyone know how to create and add a online application to a website? I am new at building
    websites myself. Thanks! in advance on any help you can give me.....
  27. Adding glitter to an image
    (3)
    Does anyone know how to add glitter to a gif image without using PSP or Adobe (If you can't
    tell, I refuse to download or pay for these programs /biggrin.gif' border='0'
    style='vertical-align:middle' alt='biggrin.gif' /> )?....

    1. Looking for adding, vars, sql

Searching Video's for adding, vars, sql
advertisement




Adding Vars To A Sql



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE