lordshoa Posted June 5, 2011 Share Posted June 5, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/238474-query-dies/ Share on other sites More sharing options...
lordshoa Posted June 5, 2011 Author Share Posted June 5, 2011 had productid should have been membershipid in the insert query Quote Link to comment https://forums.phpfreaks.com/topic/238474-query-dies/#findComment-1225427 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.