Guardian-Mage Posted June 1, 2007 Share Posted June 1, 2007 $count = "SELECT latest_id FROM cm_latest ORDER BY ABS(latest_id) LIMIT 2"; $count_out = mysql_query($count) or die("This script was unable to execute the SQL Query Count. Please contact the webmaster and inform them of the problem. Sorry for the inconvience."); $numrows1 = mysql_num_rows($count_out); $query1 = "SELECT latest_id FROM cm_latest ORDER BY ABS(latest_id) LIMIT 2"; $result1 = mysql_query($query1) or die("This script was unable to execute the SQL Query #1. Please contact the webmaster and inform them of the problem. Sorry for the inconvience."); $object1 = mysql_fetch_array($result1); extract($object1); echo $latest_id[0]; echo "<br />"; echo $latest_id[1]; echo "<br />"; echo $numrows1; exit(); That doesn't work. It doesn't print the value of latest_id[1]. I retrieved two rows and two values, how do I access the second value? Quote Link to comment https://forums.phpfreaks.com/topic/53910-accessing-mysql_fetch_array/ Share on other sites More sharing options...
Barand Posted June 1, 2007 Share Posted June 1, 2007 try <?php $query1 = "SELECT latest_id FROM cm_latest ORDER BY ABS(latest_id) LIMIT 2"; $result1 = mysql_query($query1) or die("This script was unable to execute the SQL Query #1. Please contact the webmaster and inform them of the problem. Sorry for the inconvience."); $latest_id = array(); while ($object1 = mysql_fetch_array($result1)) { $latest_id[] = $object[0]; } echo $latest_id[0] ; echo '<br>' ; echo $latest_id[1] ; ?> Quote Link to comment https://forums.phpfreaks.com/topic/53910-accessing-mysql_fetch_array/#findComment-266571 Share on other sites More sharing options...
Guardian-Mage Posted June 2, 2007 Author Share Posted June 2, 2007 doesn't work, thanks anyway Quote Link to comment https://forums.phpfreaks.com/topic/53910-accessing-mysql_fetch_array/#findComment-266614 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.