returning ONE field from a mySQL database, beginner

From: Date: Wed, 12 Jul 2000 15:00:18 +0000
Subject: returning ONE field from a mySQL database, beginner
Groups: php.general 
Request: Send a blank email to php-general+get-6148@lists.php.net to get a copy of this message
I know this is basic, but I can't find a good online tutorial that deals with this paticular subject. I have a database of pictures, with lists of the pictures name, description, links address, meta keywords, etc. the name of the picture is sent as ...pics/page.php3?pic=girlfriend and I use the following code to show the pic: print "<center><img src='/photos/$pic.jpg'><p>"; So far so good. However, I also want to print the description from the database below the picture. So I tried eleventeen versions of the following: $query = "SELECT Description FROM pictures WHERE Name = '$pic'"; $description = MYSQL_QUERY($query); print "$description</center>"; I know that this is NOT the right way, but I can't seem to figured out how. I get an output the number "2" printed under my picture. When I do the same query in phpMyAdmin (provided free by my host, along with php and MySQL) I get the results I want. You can see the script in action at http://dustycohen.net/pictures/page.php3. And the source code at http://dustycohen.net/pictures/source.html. You will need to 'View Source'. You will notice that I have commented out similar scripts for including a page title and meta tags for an included header file. The links on the acual page will work funny because it is meant to be displayed in a full-screen pop-up window, with references back to the opener window. Thank you very much for your attention to what I know is a very basic matter. If anyone knows any good tutorials (plug your site here!) please let me know. Dustin Cohen ________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

« previous php.general (#6148) next »