Problem with INSERT INTO

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fraz
Forum Newbie
Posts: 7
Joined: Thu Oct 29, 2009 7:55 am

Problem with INSERT INTO

Post 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
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Problem with INSERT INTO

Post 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?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
Weiry
Forum Contributor
Posts: 323
Joined: Wed Sep 09, 2009 5:55 am
Location: Australia

Re: Problem with INSERT INTO

Post 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?
Bryan.5050
Forum Newbie
Posts: 1
Joined: Wed Dec 02, 2009 6:10 pm

Re: Problem with INSERT INTO

Post 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.
Post Reply