Page 1 of 1

Problem with INSERT INTO

Posted: Wed Dec 02, 2009 2:29 pm
by fraz
Hi all, i need your help i spent 2 hours to find the problem and didnt see, i try to insert into my table

$query="INSERT INTO `voute` (`numboite`, `numclient`, `nummandat`, `type`, `nomclient`, `mandat`, `annee`)
VALUES ('".$_POST['numboite']."', '".$_POST['numclient']."', '".$_POST['nummandat']."', '".$_POST['type']."', '".$_POST['nomclient']."', '".$_POST['mandat']."', '".$_POST['annee']."')";

And i obtain a error

I use IIS with PHP5

Re: Problem with INSERT INTO

Posted: Wed Dec 02, 2009 3:12 pm
by AbraCadaver
fraz wrote:Hi all, i need your help i spent 2 hours to find the problem and didnt see, i try to insert into my table

$query="INSERT INTO `voute` (`numboite`, `numclient`, `nummandat`, `type`, `nomclient`, `mandat`, `annee`)
VALUES ('".$_POST['numboite']."', '".$_POST['numclient']."', '".$_POST['nummandat']."', '".$_POST['type']."', '".$_POST['nomclient']."', '".$_POST['mandat']."', '".$_POST['annee']."')";

And i obtain a error

I use IIS with PHP5
Really, an error?

Re: Problem with INSERT INTO

Posted: Wed Dec 02, 2009 5:04 pm
by Weiry
Agreed, i don't see a problem with the SQL you posted. Why not post the error rather than saying you just have an error?

Re: Problem with INSERT INTO

Posted: Wed Dec 02, 2009 6:13 pm
by Bryan.5050
Just a try but I don't put single quotes around the table field names. Try using this:

Code: Select all

$query = "INSERT INTO voute(numboite, numclient, nummandat, type, nomclient, mandat, annee)
VALUES(
'".$_POST["numboite']."',
.
.
.
)";
I am assuming the data types are all text because you are using single quotes around your POST variables.