Jump to content

SQL syntax; right syntax to use near 'order(Username,Product) VALUES ('v','b')'


Rother2005

Recommended Posts

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 'order(Username,Product) VALUES ('v','b')' at line 1

[code]<?php
include('connect1.inc');?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Booze Cruise Reg</title>

</head>
<body>

<?php
if(!$_POST['register']){echo'<p align="center"><strong>Member Registration</strong></p>
<form name="form1" method="POST" action="">
<p align="center">Username:  <input type="text" name="username" maxlength="10"></p>
<p align="center">Product:  <input type="text" name="product" maxlength="20"></p>
<p align="center"><input type="submit" name="register" value="Enter Order"></p></form>';}
//27
else{
//checks if user has input text

if(isset($_POST['username']) && !empty($_POST['username']))
{
    // valid
$username = $_POST['username'];
}
else
{
    // not valid
die ("No Username Input");
}

if(isset($_POST['product']) && !empty($_POST['product']))
{
    // valid
$product = $_POST['product'];
}
else
{
    // not valid
die ("No Product Input");
}

$sql = "INSERT INTO order(Username,Product)
VALUES ('$username','$product')";

mysql_query($sql)             

or die(mysql_error());

echo ("<meta http-equiv=\"Refresh\" content=\"2; URL=members.php\"/>Thank You! Your order has been placed");}
?>
</body>
</html>[/code]

any help??
nope im afraid that didnt work :(
right syntax to use near ''order'(Username,Product) VALUES ('sds','sdssds')' at line 1

could it be that the db im entering the data into goes:

order - int - 10 /auto increse
member - varchar - 10
product - varchar - 20
date - varchar - 255

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.