Jump to content

Recommended Posts

Hey guys, I keep getting an insert error on this:

 

<?php

if($_POST['send']) {

  $name = mysql_real_escape_string($_POST['field_3']);

  $contactnum = mysql_real_escape_string($_POST['field_4']);
  
  $adslnum = mysql_real_escape_string($_POST['field_5']);
  
    $address = mysql_real_escape_string($_POST['field_6']);

    $dslpass = mysql_real_escape_string($_POST['field_8']);

    $dsluser = mysql_real_escape_string($_POST['field_7']);

    $speed = mysql_real_escape_string($_POST['field_9']);

		    $workedprev = mysql_real_escape_string($_POST['field_10']);

    $prob_desc = mysql_real_escape_string($_POST['field_12']);

    $dial_tone = mysql_real_escape_string($_POST['field_15']);

    $modem_status = mysql_real_escape_string($_POST['field_16']);

		    $speed_test = mysql_real_escape_string($_POST['field_78']);

    $ping_tests = mysql_real_escape_string($_POST['field_83']);

    $ticket_body = mysql_real_escape_string($_POST['nt_content']);

		    $modem_type = mysql_real_escape_string($_POST['field_11']);



  $date = date('l jS \of F Y h:i:s A');
  
    $lenumber = $user['service'];

$ticket_id = md5(uniqid(rand()));


mysql_query("INSERT INTO `tickets`(`contact_name`, `contact_number`, `adsl_number`, `adsl_address`, `dsl_pass`, `dsl_user`, `speed`, `worked_prev`, `dial_tone`, `switched_on`, `speed_test`, `ping_test`, `ticket_body`, `modem_type`, `service_number`, `ticket_status`, `date`, `ticket_id`)VALUES('$name', '$contactnum', '$adslnum', '$address', '$dslpass', '$dsluser', '$speed', '$workedprev', '$prob_desc', '$dial_tone', '$modem_status', '$speed_test', '$ping_tests', '$ticket_body', '$modem_type', '$lenumber, 'Pending', '$date', '1234')") or die("Error Again.");

echo '<h2>Your Ticket has been submitted.</h2>'; 

}

?>

  

 

I've seached it about 3 times and I cannot find anything that would be putting out the error 'Error Again'

 

Please help, thanks:)

Link to comment
https://forums.phpfreaks.com/topic/130697-solved-db-insert-issue/
Share on other sites

No problem.

Notice, that the error message told you exactly where something went wrong

 

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 'Pending', 'Thursday 30th of October 2008 01:58:04 AM', '1234')' at line 1

 

Whenever you have syntax error near something, it means you screwed the things up somewhere just before that.

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.