Question:
Php help, getting id, but getting error?
spyman1o1
2009-07-15 11:52:41 UTC
Trying to get the highest id from my database, but it returns as Resource id #3
My code:
$high = mysql_query("SELECT * FROM stories ORDER BY Id DESC LIMIT 1");
echo $high;
Three answers:
flybishop
2009-07-15 12:17:25 UTC
$high = mysql_query("SELECT * FROM stories ORDER BY Id DESC LIMIT 1");



echo mysql_result($high,0,'id');
chillininvt
2009-07-15 12:02:44 UTC
$high = mysql_query("SELECT * FROM stories ORDER BY Id DESC LIMIT 1");



while($obj = mysql_fetch_object()){

print_r($obj);echo '
';

}
2009-07-15 11:59:01 UTC
I think you need to use mysql_result() on $high to get the result out. Look at documentation or http://www.freewebmasterhelp.com/tutorials/phpmysql/4


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...