Jump to content

Query dies ???


lordshoa

Recommended Posts

I have a query that just dies for not reason anyone see what it is.

 

 
$dupresult = mysql_query("SELECT `categoryid` FROM `category_memberships` WHERE `membershipid` = '4'") or die('<br /> <br /> <font color=red> <b> MySQL Querry Not Correct select category membership select </b> </font> "'.$result[$i]['productcode'].'"<br /> <br />');
if (mysql_num_rows($dupresult) > 0) {
     } else {
$upresult = mysql_query("SELECT `categoryid` FROM `categories` WHERE `category` = '".$result[$i]['submenu2']."'")  or die ('<br /> <br /> <font color=red> <b> MySQL Querry Not Correct manufacturer select </b> </font>"'.$result[$i]['manufacturer'].'" <br /> <br />');
$row = mysql_fetch_array( $upresult );

echo 'categoryid = '.$row['categoryid'].'<br /> prodcode = '.$result[$i]['productcode'].' <br /> ';

$insert = mysql_query( "INSERT INTO `category_memberships`( `categoryid`, `productid` ) VALUES( '".$row['categoryid']."', '".$result[$i]['productcode']."' )") or die('<br /> <br /> <font color=red> <b> MySQL Querry Not Correct category membership insert </b> </font>catid = '.$row['categoryid'].' --- prod =  "'.$result[$i]['productcode'].'" <br /> <br />');
}

 

 

If I take the die away it comes up with the right results but nothing is inserted into the database.

 


categoryid = 10
prodcode = 14514 
0 successfully inserted.


categoryid = 11
prodcode = 18918 
1 successfully inserted.


categoryid = 10
prodcode = 25334 
2 successfully inserted.

 

Link to comment
https://forums.phpfreaks.com/topic/238474-query-dies/
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.