RE: simple question -Select statement and recordset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PHP.NET says this about mysql_fetch_row:

mysql_fetch_row() fetches one row of data from the result associated with
the specified result identifier. The row is returned as an array. Each
result column is stored in an array offset, starting at offset 0. 

Therefore, try:

echo( $row[0] );

I didn't test it, but that last sentence in the PHP.NET description would
lead me to believe this is your problem. Seems that the results from the
mysql_fetch_row function are not stored in an associative array which is
what would allow you to use your column name to access the data in the
result set. 

Hope this helps.

Rich

> -----Original Message-----
> From: Angelo Zanetti [mailto:binc2@ctech.ac.za]
> Sent: Wednesday, May 14, 2003 9:44 AM
> To: php-db@lists.php.net
> Subject:  simple question -Select statement and recordset
> 
> 
> HI I have the following SQL query:
> 
> $result = mysql_query("SELECT title,abstract, keywords FROM 
> Biblio where BiblioID = '$ID'");
> 
> it works fine because I display the no rows effected and it echo's 1.
> 
> But how do I get the info out of the recordset??
> 
> I am trying this but no success:
> 
>     $row = mysql_fetch_row($result);
> 
>     echo( $row["title"] );
> 
> because it is only 1 set of results I am getting thats why I 
> am not using the mysql_fetch_array method.
> 
> is this the right way to get a single result or what?
> 
> thanx in advance
> 

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux