Why Doesn't The Php Page Show The Same Thing In The Logcat?
Solution 1:
Sessions are designed to be unique for each visitor, this is done by remembering the session in a cookie. Your computer will have a different session to your Android. And in fact each browser on your computer will have a different session, unless they have a way of sharing cookies.
Furthermore, scripted requests (like Android code) do not automatically remember cookies and send between requests, and so they may start a new session for each request, and lose information from the previous session.
There are a number of solutions...
Restructure your process so that you do not need to retain the messages in this way - just returning the messages from the script that deletes them maybe? Or having the first script return messages and pass the second script the message IDs to delete. This last point might also be "safer" as you're not deleting anything until you know the app has received it.
Find a way to remember cookies and send them with subsequent requests. How do I make an http request using cookies on Android? might be useful for this.
Get the session ID from PHP and send it along with all your requests. You can get and set the session ID in PHP with session_id().
The last two are not great practice for APIs, as we aim for APIs to be stateless, but they may work for you.
Solution 2:
Yeah i see the issue, thats odd i have not come across this before, but it appears you can add something to your SQL statement to correct it...
SELECT*FROM messages WHERE touser='$from'ANDWHERE touser ISNOTNULLI think that will prevent the null rows from showing. The IS NOT NULL should be the key.
Post a Comment for "Why Doesn't The Php Page Show The Same Thing In The Logcat?"