Reply to Re: PHP MySQL insert

Your name:

Reply:


Posted by "Dan Baker" on 10/20/83 11:24

"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);

You are looking for the "addslashes" function. It prepares data for
database querys:

$query = "insert into testtable6 (indx, col1, col2)";
$query .= " values (NULL, '" . addslashed($data1) . "'";
$query .= ",'" . addslashed($data2) . "'";
mysql_db_query("testdb", $query);

Also, you will need to use the "removeslashes" function when you get data
from a query.

DanB

[Back to original 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

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