Anomaly , mysql insert doesnt work

Codes here !

Moderators: macek, egami, gesf

Post Reply
rwhite35
New php-forum User
New php-forum User
Posts: 13
Joined: Thu Sep 27, 2012 10:55 am

Re: Anomaly , mysql insert doesnt work

Post by rwhite35 » Wed Oct 03, 2012 10:50 am

Instead of the literal and double quotes, try it with just the literals.

Code: Select all

$Inkelti = mysql_query("INSERT INTO `Ieskomi`(ID, VardasPavarde, GimimoMetai, Salys, Miestas, Lytis, Dingo, Apibudinimas, Nuotrauka, Statusas, KadaInkele, Inkele)
         VALUES(NULL, '$VardasPavarde', '$GimimoMetai', '$Salys', '$Miestas', '$Lytis' '$Dingo', '$Apibudinimas', '$Nuotrauka', '$Statusas', '$DATA', '$Inkele')");
Also if the column tab order is the same as your value list, you can shorten the INSERT statement to:

Code: Select all

$Inkelti = mysql_query("INSERT INTO `Ieskomi` VALUES('', '$VardasPavarde', '$GimimoMetai', '$Salys', '$Miestas', '$Lytis' '$Dingo', '$Apibudinimas', '$Nuotrauka', '$Statusas', '$DATA', '$Inkele')");
Note that the first value (ID) is empty. This assumes you are auto_incrementing the column. Finally, you should consider using prepared statements instead mysql_* functions.

Good luck

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest