Jump to content

Recommended Posts

I have a Form on registration.html through which i trying to get data in mysql through the below php script but there is and mysql syntax error please help me with the below code.

 

<?php

$conn = mysql_connect("localhost", "onlinewe_meghraj", "password123")
or die(mysql_error());
$db = mysql_select_db("onlinewe_college")
or die(mysql_error());


$name1 = $_POST['name1'];
$name2 = $_POST['name2'];
$year = $_POST['year'];
$department = $_POST['deparment'];
$group = $_POST['group'];
$in_name = $_POST['in_name'];
$in_address = $_POST['in_address'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$mobile1 = $_POST['mobile1'];
$mobile12 = $_POST['mobile2'];
$comment = $_POST['comment'];



$result=mysql_query("INSERT INTO register (name1, name2, year, department, group, in_name, in_address, phone, email, mobile1, mobile2, date, comment) VALUES ('$name1', '$name2', '$year', '$department', '$group', '$in_name', '$in_address', '$phone', '$email', '$mobile1', '$mobile2', '".date("Y-m-d h:i:s")."', '$comment')")


or die("Insert Error: ".mysql_error());

echo "REGISTRATION DONE";


?>

 

Please reply. Thank you.

Link to comment
https://forums.phpfreaks.com/topic/226146-mysql-insert-error/
Share on other sites

Sorry i forgot to post the error..

 

Insert 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 'group, in_name, in_address, phone, email, mobile1, mobile2, date, comment) VALUE' at line 1

Link to comment
https://forums.phpfreaks.com/topic/226146-mysql-insert-error/#findComment-1167427
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.