Re: [PHP] Re: PHP MySQL insert

2005-08-20 Thread areguera
On 8/19/05, Richard Lynch [EMAIL PROTECTED] wrote: On Fri, August 19, 2005 12:56 pm, areguera wrote: could you suggest something about Latin characters and portability?. As I understand it, or not, more likely, you want to configure your MySQL server to use UTF-8, and your MySQL client to

Re: [PHP] Re: PHP MySQL insert

2005-08-19 Thread Ben Ramsey
Please always reply to the list so that others can benefit from the exchange. As it happens, I'm not exactly very knowledgeable about character sets, so someone on the list may be able to offer more help with regard to the problem you're experiencing. -Ben areguera wrote: On 8/19/05, Ben

Re: [PHP] Re: PHP MySQL insert

2005-08-19 Thread areguera
sorry...here is the message On 8/19/05, areguera [EMAIL PROTECTED] wrote: On 8/19/05, Ben Ramsey [EMAIL PROTECTED] wrote: Alain Reguera Delgado wrote: you could try: 1. get all form variables into an array fine 2. validate values Good, but do this step as you put the

Re: [PHP] Re: PHP MySQL insert

2005-08-19 Thread Richard Lynch
On Fri, August 19, 2005 12:56 pm, areguera wrote: could you suggest something about Latin characters and portability?. As I understand it, or not, more likely, you want to configure your MySQL server to use UTF-8, and your MySQL client to use UTF-8 and pretty much everything to use UTF-8, and

[PHP] Re: PHP MySQL insert

2005-08-18 Thread Satyam
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

[PHP] Re: PHP MySQL insert

2005-08-18 Thread Dan Baker
Jon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 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');

[PHP] Re: PHP MySQL insert

2005-08-18 Thread Ben Ramsey
Dan Baker wrote: You are looking for the addslashes function. It prepares data for database querys: Better yet, don't use addslashes(). Use the escaping function that is specific to the database you're using. In this case, it's mysql_real_escape_string(). This is much better than using

Re: [PHP] Re: PHP MySQL insert

2005-08-18 Thread Alain Reguera Delgado
you could try: 1. get all form variables into an array 2. validate values 3. convert all values into entities using htmlentities() 4. build sql query (do some tests 'til get it right) 5. execute the built query (with proper db function) by now, commas aren't a problem, they are limited between

Re: [PHP] Re: PHP MySQL insert

2005-08-18 Thread Ben Ramsey
Alain Reguera Delgado wrote: you could try: 1. get all form variables into an array fine 2. validate values Good, but do this step as you put the values into a separate array, don't put all the values into the array first and then validate them later... make sure the input received is

Re: [PHP] Re: PHP MySQL insert

2005-08-18 Thread Jasper Bryant-Greene
Ben Ramsey wrote: You don't need to convert the values to HTML entities when saving to a database. That's not going to prevent this problem. Furthermore, you don't need to use htmlentities() if you specify your character set properly and all the characters you are outputting are in your