On Mon, 24 Nov 2003 21:36:29 -0800 (PST)
Joffrey Leevy <[EMAIL PROTECTED]> wrote:

> Would appreciate in anyone can help me.
> Let's say I do a query in php, eg. $query = "select
> shed from structure";  With the mysql_fetch_array
> function and a loop I could see all the values stored
> in the column, shed, using the command: echo $shed;
> Let's say now that I am carrying over a variable from
> a form called $form where $form = shed.  I can still
> say $query = "select $form from structure"; because
> $form = shed.
> The problem I have now is with the strings and how do
> I see my column values.
> Using echo $$value; or echo $($value) or echo \$$value
> or echo $"$value" does not give me the values stored
> in the column shed.
> Help anyone?
> thanks


First it is easier for us if you just paste the relevant code but I'll
try and assist without.

Before you can fetch a record you must query the database..
$result=mysql_query($query) or die( "Bad Query=> $query\n<br>".
mysql_error() );

The die() function will print an error if there is something wrong with
the query such as database not opened first.

You are fetching a row (or record) from the database.


therefore the value of shed column will be contained within $row.

It can be accessed by either of the two lines below.

echo $row[0];           #by numeric index..
echo $row["shed"];      #or by column name..

If you wish to find out all the column names and values, try


George Patterson

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to