You are here: Re: PHP MySQL insert « PHP « IT news, forums, messages
Re: PHP MySQL insert

Posted by "Satyam" on 10/19/88 11:24

Commas are no problem within strings. You might have an apostrophe, which
SQL assumes is the end of the string literal. That was answered by Chris
already, I just wanted to clarify the problem.

You don't need to insert NULL in indx. If indx allows NULL and has no other
default value nor is it autoincrement by not mentioning in the list of
columns nor specifying a value, it will get a NULL.

Satyam


""Jon"" <jonraston@hotmail.com> wrote in message
news:A4.E7.33075.0CDB4034@pb1.pair.com...
> Please help with an insert problem.
>
> Sometimes $data1 could have a comma and that messes up the insert. how do
> I
> get around that?
>
> $query = "insert into testtable6 (indx, col1, col2) values (NULL,
> '$data1',
> '$data2')";
> mysql_db_query("testdb", $query);

 

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

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