Php Code Required For Android App That Query Database
Solution 1:
First of all, do not use the old mysql_... functions. I recommend you PDO, but if you want it the "oldish MySQL-style" at least use MySQLi. Also, since I assume you are not familiar with the security procedures, read about SQL Injections.
But let's get to your problem :)
You need to get the result from the query and pass it on to mysql_fetch_row or one of the other fetch functions.
$result = mysql_query("select...");
echo json_encode(mysql_fetch_row($result));
Solution 2:
If you get nothing than you didn't sent your data right. Try to log your data JSONObject json = data[0];
to see what you get. Your php looks fine at first glance. When you test your code break it to smaller pieces. If you think your php is wrong then create yourself a html form above php code with input and button and then try it. If it works than it is ok. But here your problem is in android. Log your data and see what is going on. I'm not familiar with that JSONTransmiter I have never used it butt here is example that helped me with external base communication. http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/ . This is one perfect example clean and simple.
Post a Comment for "Php Code Required For Android App That Query Database"