ChrisMartino Posted April 14, 2010 Share Posted April 14, 2010 Hey i am trying to query my database and list in order of price descending but i get error with this: $result = mysql_query("SELECT * FROM Packages WHERE `Name` = `IV-MP` ORDER BY Price DESC"); Error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home3/chrismar/public_html/x-host.co.uk/packages.php on line 95 (The $result above is line 95) Anyone got any idea's?, That looks fine to me Thank you for your time! Link to comment https://forums.phpfreaks.com/topic/198559-query-problems/ Share on other sites More sharing options...
Ken2k7 Posted April 14, 2010 Share Posted April 14, 2010 When you use `, it's to let MySQL know that you want it to represent a table name or a column name. For a value, you should use single quotes. Like 'IV-MP' not `IV-MP`. Link to comment https://forums.phpfreaks.com/topic/198559-query-problems/#findComment-1041940 Share on other sites More sharing options...
PFMaBiSmAd Posted April 14, 2010 Share Posted April 14, 2010 Back-ticks `` are mysql specific anyway and should be avoided anyway. Link to comment https://forums.phpfreaks.com/topic/198559-query-problems/#findComment-1041947 Share on other sites More sharing options...
ChrisMartino Posted April 14, 2010 Author Share Posted April 14, 2010 When you use `, it's to let MySQL know that you want it to represent a table name or a column name. For a value, you should use single quotes. Like 'IV-MP' not `IV-MP`. Thanks your very helpful, You've solved every problem i have posted about xD Link to comment https://forums.phpfreaks.com/topic/198559-query-problems/#findComment-1041948 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.