Paolo, As the comments suggest, you should use something like the mysqli commands rather than mysql commands in php. The mysqli command to get the number of rows in a query result is mysqli_num_rows(). If you are looking to send this information to an Android app, the json format is very convenient to use. If you are sending just one piece of data, you could use php code like:
echo "{numrows:";
echo $total . "}";
On the android side you would use HttpURLConnection and related routines to send a get request to the website and JsonReader routines to parse the json object sent from the website. Hopefully this helps you get started on communicating with your website.
Mike Kagan
manpreet
Best Answer
2 years ago
I am trying to retrieve the row count from a mysql database and display it into a textview in android. I have the following php file:
I was hoping to get the data from the line "$total = $row[0];". Since it does hold the count of rows. I am still learning about this whole json android php connection thing. So I would appreciate if someone will aid me! Thanks!