ipwnzphp Posted February 17, 2007 Share Posted February 17, 2007 Hello, The frist if statement works but the next one dosent. if ($pull_haunt_cat[filed_name] == "1") { $listing_name = $_POST[listing_name]; if ($listing_name == NULL) { echo "You must fill out every filed on the form before you can add your listing OR You must accpet the submit listing policy!"; } else { mysql_query("INSERT INTO `listings` (listing_name) VALUES ('$listing_name')") or die (mysql_error()); } } $query = mysql_query("SELECT * FROM `listings` WHERE listing_name = '$listing_name'") or die (mysql_error()); $row = mysql_fetch_array($query); if ($pull_haunt_cat[filed_street] == "1") { echo "ff"; $listing_street = $_POST[listing_street]; if ($listing_street == NULL) { echo "You must fill out every filed on the form before you can add your listing OR You must accpet the submit listing policy!"; } else { mysql_query("UPDATE `listings` SET listing_street= '$listing_street' WHERE id = '$row[id]'") or die (mysql_error()); } } ??? Link to comment https://forums.phpfreaks.com/topic/38954-solved-if-statement-works-but-next-one-dont/ Share on other sites More sharing options...
JasonLewis Posted February 17, 2007 Share Posted February 17, 2007 what should be happening and what is happening? Link to comment https://forums.phpfreaks.com/topic/38954-solved-if-statement-works-but-next-one-dont/#findComment-187502 Share on other sites More sharing options...
ataria Posted February 17, 2007 Share Posted February 17, 2007 nevermind =x Link to comment https://forums.phpfreaks.com/topic/38954-solved-if-statement-works-but-next-one-dont/#findComment-187504 Share on other sites More sharing options...
ipwnzphp Posted February 17, 2007 Author Share Posted February 17, 2007 it shuld be inserting the data then updating what it just added. but its not updating its only adding. Link to comment https://forums.phpfreaks.com/topic/38954-solved-if-statement-works-but-next-one-dont/#findComment-187519 Share on other sites More sharing options...
Greaser9780 Posted February 17, 2007 Share Posted February 17, 2007 You need single quotes around id WHERE id = '$row[id]'") (\"UPDATE `listings` SET listing_street='$listing_street' WHERE id = " .$row['id']."\") Try that once. Link to comment https://forums.phpfreaks.com/topic/38954-solved-if-statement-works-but-next-one-dont/#findComment-187531 Share on other sites More sharing options...
ipwnzphp Posted February 17, 2007 Author Share Posted February 17, 2007 no luck still Link to comment https://forums.phpfreaks.com/topic/38954-solved-if-statement-works-but-next-one-dont/#findComment-187568 Share on other sites More sharing options...
JasonLewis Posted February 17, 2007 Share Posted February 17, 2007 try this: if($pull_haunt_cat['filed_name'] == "1"){ $listing_name = $_POST[listing_name]; if($listing_name == ""){ echo "You must fill out every filed on the form before you can add your listing OR You must accpet the submit listing policy!"; }else{ mysql_query("INSERT INTO `listings` (`listing_name`) VALUES ('$listing_name')") or die (mysql_error()); } } if($pull_haunt_cat['filed_street'] == "1"){ echo "ff"; //Whats this for? $listing_street = $_POST['listing_street']; if($listing_street == ""){ echo "You must fill out every filed on the form before you can add your listing OR You must accpet the submit listing policy!"; }else{ if(mysql_query("UPDATE `listings` SET listing_street= '$listing_street' WHERE `listing_name`='{$listing_name}'")){ echo "Success!"; }else{ echo "Failed!"; } } } but tell me, why are you updating it after its inserted. why not insert it all in one hit? Link to comment https://forums.phpfreaks.com/topic/38954-solved-if-statement-works-but-next-one-dont/#findComment-187575 Share on other sites More sharing options...
ipwnzphp Posted February 18, 2007 Author Share Posted February 18, 2007 not working still. Link to comment https://forums.phpfreaks.com/topic/38954-solved-if-statement-works-but-next-one-dont/#findComment-187604 Share on other sites More sharing options...
JasonLewis Posted February 18, 2007 Share Posted February 18, 2007 but tell me, why are you updating it after its inserted. why not insert it all in one hit? Link to comment https://forums.phpfreaks.com/topic/38954-solved-if-statement-works-but-next-one-dont/#findComment-187627 Share on other sites More sharing options...
ipwnzphp Posted February 18, 2007 Author Share Posted February 18, 2007 its checking to make sure that the filed is true and not false 0 dont show filed 1 show filed Link to comment https://forums.phpfreaks.com/topic/38954-solved-if-statement-works-but-next-one-dont/#findComment-187628 Share on other sites More sharing options...
ipwnzphp Posted February 18, 2007 Author Share Posted February 18, 2007 signs that ur programing to long.. you think a filed name is filed name when its not.. a bone head mistake.. lol topic sloved! i misspelled the filed name. Link to comment https://forums.phpfreaks.com/topic/38954-solved-if-statement-works-but-next-one-dont/#findComment-187735 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.