I have a form that uses a query in the following format: "Select from TABLE where field !=\"\" order by field asc". However, when the query gets submitted I get "Select from TABLE where field !=" I have tried urlencoding but it didn't do the trick.
Any suggestions?
thanks,
Luis
Yeah, dont use the double quotes inside the SQL-string, use single. Like:
"SELECT * FROM table WHERE x !='' ORDER BY y asc"
try it!
Also note that there is a big difference in empty fields and fields containing NULL. Actually, if you do this at MySQL CLI :
mysql> SELECT NULL = NULL;
You get a NULL. Be sure to check out the nature of NULLs and empty fields!
You submit queries? please tell me that does not mean you do things like
<input type=text name=query value="SELECT * FROM TABLE">
:-) Nope, don't! Why should I do like that?
You shouldn't like to do that! :-)
But I've seen people do that, create a link that uses the GET method to send an SQL query which is then executed on the server.
Can you post a codesample of how you make the query before you execute it?