petenaylor Posted March 24, 2011 Share Posted March 24, 2011 Hi all I am trying to get the contents from an array using the below SQL query: $sql = mysql_query ("SELECT MAX (postage_world) FROM `basket` "); while ($row = mysql_fetch_array($sql)) { echo $row["id"]; echo $row["description"]; echo $row["postage_world"]; } I need the SQL query to find the highest value from the table and then echo out the results. The error I get is "Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given" Many thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/231583-get-max-from-sql-and-echo-out/ Share on other sites More sharing options...
MrXHellboy Posted March 24, 2011 Share Posted March 24, 2011 SELECT MAX (postage_world) FROM basket Quote Link to comment https://forums.phpfreaks.com/topic/231583-get-max-from-sql-and-echo-out/#findComment-1191668 Share on other sites More sharing options...
MrXHellboy Posted March 24, 2011 Share Posted March 24, 2011 Sorry SELECT MAX (postage_world) as something FROM basket Quote Link to comment https://forums.phpfreaks.com/topic/231583-get-max-from-sql-and-echo-out/#findComment-1191672 Share on other sites More sharing options...
petenaylor Posted March 24, 2011 Author Share Posted March 24, 2011 That's great! Many thanks Quote Link to comment https://forums.phpfreaks.com/topic/231583-get-max-from-sql-and-echo-out/#findComment-1191673 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.