You are here: MySQL INSERT error « PHP Programming Language « IT news, forums, messages
MySQL INSERT error

Posted by Jacob Lyles on 11/18/98 11:40

Howdy,

I'm a but of a newbie and I'd appreciate some help with a MySQL issue
I'm having. I'm trying to insert some data into MySQL from a POST form
but the query breaks whenever a user fails to fill out a value. Here's
the PHP code that breaks when the $_POST[opus] variable is left blank:

mysql_query("INSERT INTO piece VALUES (NULL, '$_POST[composer]',
$_POST[opus], $_POST[year], '$_POST[name]' , '$_POST[work_type]',
$_COOKIE[user_cookie])") or die(mysql_error());

Here's my error message:

"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 '1865,'Symphony No. 2 in B-flat Major','1',15)' at line 1"

And lastly, here's the settings of the mySQL field:

opus is a mediumint of length nine. NULL = yes. Default = NULL.

Thanks,
Jacob

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация