Query:
INSERT INTO partsx(`Description`, `Part_Number`, `Document', `Link`) VALUES('SAS Type I','a','b', 'c')
Failed with 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 'Link`) VALUES('SAS Type I','a','b', 'c')' at line 1.
I do not see the problem.
Code is below
<?php
include 'inputdata.php';
//connecting to databse;
if (!mysql_connect('localhost:3306', $username, $password)) {
die('Failed to connect to database');
}
if (!mysql_select_db($database)) {
die("Failed to select database $database". mysql_error());
}
//
//collecting data from index.php;
$Description = mysql_real_escape_string($_POST["Description"]);
$Part_Number = $_POST["Part_Number"];
$Document = mysql_real_escape_string($_POST["Document"]);
$Link = mysql_real_escape_string($_POST["Link"]);
//inserting data into table partsx;
$create = "INSERT INTO partsx(`Description`, `Part_Number`, `Document', `Link`) VALUES('$Description','$Part_Number','$Document', '$Link')";
mysql_query($create) or die("Query $create failed: " .mysql_error());
?>
This post has been edited by RudiVisser: 08 September 2011 - 12:26 PM
Reason for edit:: use [CODE] tags (correctly)!

New Topic/Question
Reply


MultiQuote





|