Saturday 15 June 2013

php - My SQL query using exception while getting data -


I'm using MySQL to get data from the table but it shows an exception. Here I am using the code I'm calling it through the URL for testing:

  $ userName = mysql_real_escape_string ($ _GET ['userName']); $ Query = mysql_query ("Select from user credentials where username = '$ username'"); The exception is   

Here is the exception

  Warning: mysql_fetch_assoc (): The logic supplied is not a valid MySQL Resource / In-Home Here's the full code               $ userName = mysql_real_escape_string ($ _GET ['username']); $ Query = mysql_query ("Select from user credentials * where username = '$ username'"); $ Rows = array (); While ($ line = mysql_fetch_assoc ($ query)) {$ rows [=] $ line; } Echo json_encode ($ rows); ? & Gt;  
  $ query = sprintf ("Select * from user credentials where UserName = '% S' ", mysql_real_escape_string ($ _ receiving ['uSERNAME'])); $ Result = mysql_query ($ query); If (results) {// you code}    

No comments:

Post a Comment