m00nz00mer Posted February 19, 2008 Share Posted February 19, 2008 Hey im having some problems with this piece of code, can someone tell me why this isnt working. Cheers. <?php $titleQuery = mysql_query("SELECT catDesc FROM tablename WHERE catID='".$_GET['categoryID']."'"); $titleQueryResult = mysql_query($titleQuery); $title = mysql_result($titleQueryResult, 0); echo $title; ?> Error is... Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_p185724/public_html/categories.php on line 84 line 84 is: $titleQueryResult = mysql_query($titleQuery); Cheers. Link to comment https://forums.phpfreaks.com/topic/91881-correct-syntax/ Share on other sites More sharing options...
rhodesa Posted February 19, 2008 Share Posted February 19, 2008 You are executing mysql_query() twice. Remove the mysql_query from the first line. Link to comment https://forums.phpfreaks.com/topic/91881-correct-syntax/#findComment-470520 Share on other sites More sharing options...
m00nz00mer Posted February 19, 2008 Author Share Posted February 19, 2008 just changed it to... $titleQuery = ("SELECT catDesc FROM tablename WHERE catID='".$_GET['categoryID']."'"); $titleQueryResult = mysql_query($titleQuery); $title = mysql_result($titleQueryResult, 0); but im still getting the same error. Link to comment https://forums.phpfreaks.com/topic/91881-correct-syntax/#findComment-470523 Share on other sites More sharing options...
rhodesa Posted February 19, 2008 Share Posted February 19, 2008 change it to this and let us know what it says: $titleQuery = "SELECT catDesc FROM tablename WHERE catID='".$_GET['categoryID']."'"; $titleQueryResult = mysql_query($titleQuery) or die("Query error: ".mysql_error()); $title = mysql_result($titleQueryResult, 0); Link to comment https://forums.phpfreaks.com/topic/91881-correct-syntax/#findComment-470525 Share on other sites More sharing options...
m00nz00mer Posted February 19, 2008 Author Share Posted February 19, 2008 hah, table didnt exist... silly me, thanks for you help Link to comment https://forums.phpfreaks.com/topic/91881-correct-syntax/#findComment-470534 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.