WinInet analog HTTP POST request error
This post was last edited by dimply on 2014-06-09 14:02:10
Set the breakpoint trace execution inside the VS2012, and find that the PHP file is not getting the correct return string, but the following error message:
Invalid query:
You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near "at line 1
Whole query:
Select Id,name from Index_activities where top=0
This is the message I have in PHP
$result = mysql_query ($query);
After the statement line, the "if" request is not successful, obviously the MySQL request is unsuccessful, and you can determine that the PHP file was successfully invoked.
But when I call the same PHP file with the same parameters in the Web page (get mode), the return value is correct.
My php file is used to get the parameters.
$top = $_request[' top '];
So the post and get parameters should all be equally available.
Don't know where it might have gone wrong? Do you have any exceptions to this request string by WinInet?
------Solution--------------------
Invalid query:
You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near "at line 1
Whole query:
Select Id,name from Index_activities where top=0
This information is clearly the fault of the database report!
If $query = "Select Id,name from Index_activities where top=0"; OK
and $query = "Select Id,name from index_activities where top= $top"; No
This means $top no value or no number
------Solution--------------------
$top = $_request[' top ']; Switch
$top = intval ($_request[' top ');Give it a try