RE: [PHP-DB] simple question -Select statement and recordset
| From: | Hutchins, Richard | Date: | Wed, 14 May 2003 13:49:41 +0000 |
| Subject: | RE: [PHP-DB] simple question -Select statement and recordset | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-27745@lists.php.net to get a copy of this message | ||
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: [PHP-DB] 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
>