Android Question Connect Android to MySQL Database

hanyelmehy

Active Member
Licensed User
Longtime User

josejad

Expert
Licensed User
Longtime User
Hi:

It would be useful to know the error you get and the PHP code you're using
 
Upvote 0

hanyelmehy

Active Member
Licensed User
Longtime User
Hi:

It would be useful to know the error you get and the PHP code you're using
i mention that i use above tutorial ,something like
B4X:
Sub ExecuteRemoteQuery(Query As String, JobName As String)
    Dim job As HttpJob
    job.Initialize(JobName, Me)
    job.PostString(PhpScript_URL, Query)
End Sub
every thing work fine for any normal query ,when use Like parameter and wildcard % ,PostString not work correctly and return this
B4X:
Query :SELECT * FROM wftable WHERE webadd LIKE '%google%'
ResponseError. Reason: , Response: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<p>Additionally, a 400 Bad Request
error was encountered while trying to use an ErrorDocument to handle the request.</p>
<hr>
</body></html>
when use urlencode (Query :SELECT * FROM wftable WHERE webadd LIKE '%25google%25')
it work but mysql return not correct result
 
Last edited:
Upvote 0

hanyelmehy

Active Member
Licensed User
Longtime User
For security purpose, I don’t think it is a good idea to post the SQL in query. This will cause sql injection issue.
i know that jrdc is better option ,but server not support that (you can't run jar files) ,also i try :
-avoid any injection syntax
-use https
-encrypt script address
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
If your php file is search.php then you normally call http://my domain.com/search.php?text=google
You don’t need to post the entire SQL command. You write your SQL command inside your PHP file.
 
Upvote 0
Top