HDFilmMaker2112 Posted May 12, 2011 Share Posted May 12, 2011 I'm pretty much taking over the MySQL sub-forum... lol. Sorry for so many threads guys, but this is the first time I've been this in depth in MySQL. The below is throwing the following error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/zyquo/public_html/ghosthuntersportal.com/product_process.php on line 33 Line 33 is: while($row11=mysql_fetch_array($result11)){ elseif($_GET['do']=="add"){ $sql10="INSERT INTO $tbl_name (product_name, product_price, product_category, product_link, product_image, product_tag, product_features, product_pros, product_cons, product_description, product_notes) VALUES ('$product_name', '$product_price', '$product_category', '$product_link', '$product_image', '$product_tag', '$product_features', '$product_pros', '$product_cons', '$product_description', '$product_notes')"; mysql_query($sql10); $sql11="SELECT product_id FROM $tbl_name WHERE product_name=".$product_name.""; $result11=mysql_query($sql11); while($row11=mysql_fetch_array($result11)){ $product_id2=$row11['product_id']; $sql12="INSERT INTO $tbl_name2 (keyword,product_id) VALUES ('$keyword','$product_id2')"; mysql_query($sql12); } } query sql10 runs and inserts the data, query sql11 does not run. Link to comment https://forums.phpfreaks.com/topic/236192-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result/ Share on other sites More sharing options...
phppaper Posted May 12, 2011 Share Posted May 12, 2011 try: $sql11="SELECT product_id FROM $tbl_name WHERE product_name='".$product_name."' "; with single quote for ".$product_name." Link to comment https://forums.phpfreaks.com/topic/236192-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result/#findComment-1214357 Share on other sites More sharing options...
HDFilmMaker2112 Posted May 12, 2011 Author Share Posted May 12, 2011 That took care of it, thanks. Link to comment https://forums.phpfreaks.com/topic/236192-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result/#findComment-1214368 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.