[PHP] displaying certain columns

2001-09-30 Thread Melih Onvural

i have a database and it randomly selects one piece of data from a table of
quotes, but it will only print the quote when I include the row that it's
picked with. I have my SELECT statement at

$sql = SELECT $dbrow FROM $dbtable ORDER BY RAND() LIMIT 1;

and then to display the result

$result = mysql_db_query($dbname, $sql)


then in the code,

print td $result /td;

what do i need to add? (the result is Resource id #3)

thank you,
Melih



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] displaying certain columns

2001-09-30 Thread Christian Dechery

You have to fetch the row data with some function...

try mysql_fetch_row() or mysql_fetch array(), examples:

$arr=mysql_fetch_row($result);
echo $arr[0];

or

$arr=mysql_fetch_array($result);
echo $arr[$dbrow];

that should do...


At 21:19 30/9/2001 -0400, you wrote:
i have a database and it randomly selects one piece of data from a table of
quotes, but it will only print the quote when I include the row that it's
picked with. I have my SELECT statement at

$sql = SELECT $dbrow FROM $dbtable ORDER BY RAND() LIMIT 1;

and then to display the result

$result = mysql_db_query($dbname, $sql)


then in the code,

print td $result /td;

what do i need to add? (the result is Resource id #3)

thank you,
Melih



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]