I am having a problem while uploading a string to MySQL database. Here's the things I use:
- EditText for user input
- PHP file that receives string from the application and inserts into the database
The PHP file I use for communication:
<?php
$con = mysql_connect("SERVER","DB_NAME","PASS");
if (!$con)
{
die('Could not Connect:'. mysql_error());
}
mysql_select_db("DB_NAME",$con);
mysql_query ("INSERT INTO table_name (id) VALUES('".$_REQUEST['st_Id']."')");
mysql_close($con);
?>
When I try to insert text into the EditText in android and that text includes a quotation marks the operation fails, otherwise the operation is working fine. I guess the problem in the PHP file while receiving the string but I have no idea how to solve it.
Any ideas?