RE: [PHP-DB] Resource id ... what is this?
| From: | Peter Lovatt | Date: | Sat, 24 May 2003 13:13:50 +0000 |
| Subject: | RE: [PHP-DB] Resource id ... what is this? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-28002@lists.php.net to get a copy of this message | ||
Hi
You are trying to display the link to the query rather than results
themselves.
$query = 'SELECT * FROM table WHERE field="some condition"';
$mysql_result = mysql_query($query, $link);
$retval.='<table width="95%">';
while($row = mysql_fetch_array($mysql_result))
{// enter display code here
$retval.='<tr><td> </td><td> </td><td> </td><td> </td></
tr>';
$retval.='<tr><td>'.$row[""].' </td><td>'.$row["some_field"].' </t
d><td>
'.$row["some_other_field"].' </td><td> </td></tr>';
$retval.='<tr><td> </td><td> </td><td> </td><td> </td></
tr>';
}// end while
$retval.='</table>';
print $retval ;
you are probably doing
$query = 'SELECT * FROM table WHERE field="some condition"';
$mysql_result = mysql_query($query, $link);
print $mysql_result ;
(which prints the resource ID)
If this doesn't help come back to me.
PS Better to post code rather than just a discription of the problem
HTH
Peter
-----Original Message-----
From: Kenneth Wright [mailto:kenwright@orange.net]
Sent: 24 May 2003 13:42
To: php-db@lists.php.net
Subject: [PHP-DB] Resource id ... what is this?
Dear Group,
I am trying to do a simple HTML/PHP database query against a MySql database.
When I run the query in the monitor and in PHPMyAdmin .... I get exactly the
response I am looking for. When I run in through Apache1.3+/PHP4+ on Windows
2000, I get a response "Resource id #" with the number 3 or 11 or whatever
against the #. My calls pass all my tests ..... The connection to the
database is OK ... the password, table, localhost, user etc etc tests are
all OK, but all I get back is this string "Resource id #3" or whatever
number. I have tried rewriting the code many times following many textbook
suggestions ... but still the same result.
Anybody got any ideas where I am going wrong.
Thanks
Ken
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php