Jump to content

Weird problem with INSERT script


patheticsam

Recommended Posts

Hi!

 

I just a small form to insert some data into a MYSQL database and can't get it working...The weird thing is that I use the same script in other sections on my website and it works perfectly so if anyone can figure what i'm doing wrong......

 

 

here's the form code (pretty simple) :

 

<form id=\"order\" name=\"order\" method=\"post\" action=\"members/order.php\">
<input type=\"hidden\" name=\"itemid\" id=\"itemid\" value=\"".$info['item_id']."\">
<input type=\"hidden\" name=\"status\" id=\"status\" value=\"Unconfirmed\">
<input type=\"hidden\" name=\"payment\" id=\"payment\" value=\"Not received\">
   <a href=\"members/order.php\"><img src=\"../img/buynow.jpg\" alt=\"Acheter\" /></a>
</form>

 

 

And here's the order.php part :

 

<?php
require_once('auth.php');
?>
<?php
//Start session
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link href="../css/style2.css" rel="stylesheet" type="text/css" />
<title>LVA ENTERTAINEMENT</title>
</head>
<body>
<?php
$con = mysql_connect("localhost","login","pass");

$member = $_SESSION['SESS_MEMBER_ID'];
$itemid = mysql_real_escape_string($_POST['itemid']);
$status = mysql_real_escape_string($_POST['status']);
$payment = mysql_real_escape_string($_POST['payment']);

if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }mysql_select_db("DB", $con);
$sql="INSERT INTO order ( item_id, member_id, status, payment)
VALUES
('$member','$itemid','$status','$payment')";if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }

echo "<br /><br /><center>Votre artiste a correctement été ajouté à la base de donnée.<br /><br /><a href=\"../dashboard.php\" target=\"main2\">Retour au paneau de contrôle</a></center>";
?>
</body>
</html>

 

 

Please help!

 

Link to comment
https://forums.phpfreaks.com/topic/196609-weird-problem-with-insert-script/
Share on other sites

Here's the error I'm getting :

 

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 'order ( item_id, member_id, status, payment) VALUES ('4','','','')' at line 1

 

 

(We can see that the form is not passing out the values.....)

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.