PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
if (!$name) {echo "You must enter your full name."; } else {
if (!$email) {echo "We need your Email"; } else {
if (!$phone) {echo "We must know your phone number to get back to you."; } else {
if (!$location) {echo "Please fill out the location section."; } else {
if (!$other ) {
if (!$yr) {echo "Please fill out the year of your car."; } else {
if (!$make) {echo "Please fill out the make of your car"; } else {
if (!$model) {echo "Please fill out the model of your car"; } else {
}
}
}
}
if (!$car) {echo "Please include a link to a picture of your car."; } else {
if (!$self) {echo "Please include a link to a picture of your self."; } else {
include ("join/config.php");
mysql_connect($server, $user, $password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());
$sql = mysql_query("INSERT INTO `join` (id, name, email, phone, location, yr, make, model, car, self) VALUES ('', '".$_POST['name']."','".$_POST['email']."','".$_POST['phone']."','".$_POST['location']."','".$_POST['yr']."','".$_POST['make']."','".$_POST['model']."','".$_POST['car']."','".$_POST['self']."')") or die(mysql_error());
mysql_query($sql) or die(mysql_error());
echo ("Thank you for your request to Join our Team.<br> We will get back to you as soon as possible.<br> ");
$SiteName = "Team Exile";
$SiteEmail = "hondavtecdriver@gmail.com";
$ThankYouMessage = "Thank you from Team Exile";
$SiteUserName = "Team Exile";
$AdminMessage .= "Another Request to Join the Team \n";
mail("$SiteEmail", "Team Exile", $AdminMessage, "From: $email");
}
}
}
}
}
}
The Error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1
But the thing is, it will still submit it to the database... It also will not email me.
echo out the query string to determine where in the query it's failing, and check visually if you see anything wrong.. I'm guessing an input may contain a quote mark.
<?php
case '4b':
if (!$name) {echo "You must enter your full name."; } else {
if (!$email) {echo "We need your Email"; } else {
if (!$phone) {echo "We must know your phone number to get back to you."; } else {
if (!$location) {echo "Please fill out the location section."; } else {
if (!$other ) {
if (!$yr) {echo "Please fill out the year of your car."; } else {
if (!$make) {echo "Please fill out the make of your car"; } else {
if (!$model) {echo "Please fill out the model of your car"; } else {
}
}
}
}
if (!$car) {echo "Please include a link to a picture of your car."; } else {
if (!$self) {echo "Please include a link to a picture of your self."; } else {
echo mysql_error();
include ("join/config.php");
echo mysql_error();
mysql_connect($server, $user, $password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());
echo mysql_error();
$sql = mysql_query("INSERT INTO `join` (id, name, email, phone, location, yr, make, model, car, self) VALUES ('', '".$_POST['name']."','".$_POST['email']."','".$_POST['phone']."','".$_POST['location']."','".$_POST['yr']."','".$_POST['make']."','".$_POST['model']."','".$_POST['car']."','".$_POST['self']."')") or die(mysql_error());
mysql_query($sql) or die(mysql_error());
echo ("Thank you for your request to Join our Team.<br> We will get back to you as soon as possible.<br> ");
echo mysql_error();
$SiteName = "Team Exile";
$SiteEmail = "hondavtecdriver@gmail.com";
$ThankYouMessage = "Thank you from Team Exile";
$SiteUserName = "Team Exile";
$AdminMessage .= "Another Request to Join the Team \n";
mail("$SiteEmail", "Team Exile", $AdminMessage, "From: $email");
echo mysql_error();
}
}
}
}
}
}
break;
?>
you are inserting a blank value into a auto incrementing fiend (your id)
you cant do that, just take out id and take out the
'' that you have for its value other than that i dont see a
problem in your sql.