Jump to content

correct syntax??


m00nz00mer

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.