Jump to content

[SOLVED] what is the error in this script


jck

Recommended Posts

$rnextcat = mysql_query("SELECT CategoryID from dd_categories WHERE  CategoryID > '$a1[itemCategory]' ORDER by CategoryID DESC LIMIT 1");
$rnc = mysql_fetch_array($rnextcat);
$rncid = mysql_query("SELECT ItemID from dd_items WHERE ItemCategory = '$rnc['CategoryID']' AND ItemStatus = 'approved' ORDER by ItemID DESC LIMIT 1");
$rowncid = mysql_fetch_array($rncid);
$next = $rowncid['ItemID'];

 

to fetch the first item of the next category....... it seems ok but its not worrking

Link to comment
https://forums.phpfreaks.com/topic/60359-solved-what-is-the-error-in-this-script/
Share on other sites

In the third variable (second mySQL query), you've chnaged the way it's written "...WHERE ItemCategory = '$rnc['CategoryID']' AND...". You need to remove the two innermost quote marks so it reads "..."WHERE ItemCategory = '$rnc[CategoryID]' AND...".

 

Also in the first one you have a double space between "WHERE" and "CategoryID". you need to remove that. If that still doesn't work, tell us what the error message says.

 

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.