Jump to content

Mysql query error not helpful...


Sparkflash

Recommended Posts

Can anyone tell me whats wrong with this code?  The mysql error I get is generic and says

 

"Could not enter data: 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 'Tickets (Name,Tech,Node,Address,Tap,Ped,Lash,Hardline,Other,Comments) VALUES ('C' at line 1"

<?php
$name=$_POST['name'];
$id=$_POST['id'];
$node=$_POST['node'];
$ped=$_POST['ped'];
$tap=$_POST['tap'];
$lash=$_POST['lash'];
$hardline=$_POST['hardline'];
$other=$_POST['other'];
$address=$_POST['address'];
$city=$_POST['city'];
$comments=$_POST['comments'];

$dbhost = 'xxxx';
$dbuser = 'xxxx';
$dbpass = 'xxxx';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
  die('Could not connect: ' . mysql_error());
}


$sql = "INSERT INTO Damage Tickets (Name,Tech,Node,Address,Tap,Ped,Lash,Hardline,Other,Comments) VALUES ('$name','$id','$node','$address','$city','$tap','$ped','$lash','$hardline','$other','$comments')";
mysql_select_db('xxxxx');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
  die('Could not enter data: ' . mysql_error());
}


echo "Your Damage has been Submitted!  <a href=\"damage.php\">Go Back</a>";
mysql_close($conn);

?> 

No idea whats wrong with it?  Thanks for any help

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.