jmac2501 Posted May 29, 2007 Share Posted May 29, 2007 Hey, i am having trouble finding out how i can verify that the data that i inserted into my db realy got there, and if it did to redirect me to another page. and if the data didn't get inserted to re-direct me to a diffrent page. Any kind of code you could show me would be great. Link to comment https://forums.phpfreaks.com/topic/53356-solved-verify-info-was-placed-in-db/ Share on other sites More sharing options...
gabeg Posted May 29, 2007 Share Posted May 29, 2007 <?php $sql = "INSERT INTO blah blah blah"; if(mysql_query($sql)) { echo "Success!"; //or do a redirect here }else { echo "Error!!!"; } ?> Link to comment https://forums.phpfreaks.com/topic/53356-solved-verify-info-was-placed-in-db/#findComment-263692 Share on other sites More sharing options...
jmac2501 Posted May 29, 2007 Author Share Posted May 29, 2007 I get an error saying that there is no $end Here is what i have $sql = "INSERT INTO listings (`streetaddress`, `city`, `price`, `squarefeet`, `bed`, `Fbath`, `Hbath`, `reo`, `agent`, `pic`) VALUES ('$streetaddress','$city','$price','$squarefeet','$bed','$Fbath','$Hbath','$REO','$agent','$pic')"; echo("$sql"); mysql_query($sql); if(mysql_query($sql)) { echo "Success!"; header("Location: http://sacvalleyhomes.com/Members/add.htm"); } else { echo "Error!!!"; header("Location: http://sacvalleyhomes.com/Members/add2.htm"); } ?> Link to comment https://forums.phpfreaks.com/topic/53356-solved-verify-info-was-placed-in-db/#findComment-263715 Share on other sites More sharing options...
gabeg Posted May 29, 2007 Share Posted May 29, 2007 Here is what i have <?php $sql = "INSERT INTO listings (`streetaddress`, `city`, `price`, `squarefeet`, `bed`, `Fbath`, `Hbath`, `reo`, `agent`, `pic`) VALUES ('$streetaddress','$city','$price','$squarefeet','$bed','$Fbath','$Hbath','$REO','$agent','$pic')"; //echo("$sql"); <-no //mysql_query($sql); if(mysql_query($sql)) { //echo "Success!"; <-header must be sent before any output. so don't echo anything header("Location: http://sacvalleyhomes.com/Members/add.htm"); } else { //echo "Error!!!"; <-header must be sent before any output. so don't echo anything header("Location: http://sacvalleyhomes.com/Members/add2.htm"); } ?> and I don't see where $end fits into here, so make those changes, and see what happens Link to comment https://forums.phpfreaks.com/topic/53356-solved-verify-info-was-placed-in-db/#findComment-263720 Share on other sites More sharing options...
jmac2501 Posted May 29, 2007 Author Share Posted May 29, 2007 get same error Parse error: parse error, unexpected $end in... Link to comment https://forums.phpfreaks.com/topic/53356-solved-verify-info-was-placed-in-db/#findComment-263722 Share on other sites More sharing options...
jmac2501 Posted May 29, 2007 Author Share Posted May 29, 2007 Fixed was missing another } to close it off Link to comment https://forums.phpfreaks.com/topic/53356-solved-verify-info-was-placed-in-db/#findComment-263759 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.