Problem with text including comma in mysql

hello I’m using mysql as my database, but when I insert a text with a comma, it interrupts the text in the comma and the rest of the text doesn’t appear after the comma, how can I solve this?

put all the vale in quotes and seperate it by comma.
May be this work.
because i used this in website form submission so may be this will work.

It depends on the code you are using, with this code we can put a comma.

http://kio4.com/appinventor/340C_appinventor_mysqli.htm

I use the Pura Vida code, can I change it?

https://puravidaapps.com/mysql.php

You can test the code that I have put on my website to see if it interests you.

Or before putting in mysql from app use replace all text block with this and after getting data from sql then also replace all blocks with.
Comma will convert to list.

I think you cannot use comma in a mysql query because it is used to separate values in query.
But you can do this:

1 Like

Using PHP, you have this option:
$name = "Meu Nome é Marcos Macdonald´s ";
echo addslashes ($name);
// Meu Nome é Marcos Macdonald/s
Other functions:
mysql_real_escape_string()
mysql_escape_string()

Can you show what’s going on?

hello, I managed to solve by adding “quotes” at the beginning and end of the text, well the application is only for data visualization, the registration will all be done through a software developed in lazarus, so by lazarus I managed to make it add “quotes” in text, this way is correct?

Well, I know that when there are double or single quotes, if the string has quotes, these must be different from the outer quotes.
"Select campo1,campo2,campo3 from TbTable where campo1 = ’ ". $variable. " ’ ";
In this case the $ variable has to be between simple apas so I do it this way.

You must use characters other than commas in the database,for example using the character (-) to replace (,), then when you want to display the text in your app, replace (-) with (,) using the block “replace all text”

thanks to everyone in the community, I managed to solve my problem, I did a function in lazarus that adds quotes at the beginning and end of the text when saving.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.