php - MySQLi issue: connecting but query not working -


I'm not sure what the problem is, but I am very basic with mysql and I'm still learning though I've been searching for over two hours on the internet and I did not understand what I did.

  & lt ;? Php $ id = 0; // Create Connection $ conn = new mysqli ($ servername, $ dbname, $ password); // Check connection if ($ conn- & gt; connect_error) {dead ("Connection failure". $ Conn- & gt; connect_error); } $ User_qry = "Choose * user WHERE id = $ id"; $ Result = $ conn- & gt; Query ($ user_qry); Echo ("& lt; ago"); Print_r ($ result); $ Conn- & gt; near (); ? & Gt;  

I have not found any connection errors, but I

You have to achieve the result after performing the query:

  $ result = $ conn-> Query ($ user_qry) while ($ row = $ result-> fetch_assoc ()) {print_r ($ line); }  

Theft comment from another SO post, Regarding:

  $ result = $ conn- & gt; Query ($ user_qry) if (! $ Result) {new exception throw ("database error [{$ this-> database-> wrong]] {$ this-> database-> error}"); }  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -