Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to run query: ?? No query error message leads me nowhere
    primarykey
    data
    text
    <p>SO I have this authentication code. Everything else works except when I input a wrong user name. It just keeps showing in the page: "Unable to run query:" &lt;-- Only this. I don't know what's wrong. Please do help.</p> <p>Here's my code for that part:</p> <pre><code>if($UserN){ if($UserP){ require("connect.php"); $query = mysql_query("SELECT * FROM customer WHERE UserName = '$UserN'"); $numrows = mysql_num_rows($query) or die ('Unable to run query:'.mysql_error()); if($numrows == 1){ $row = mysql_fetch_assoc($query)or die ('Unable to run query:'.mysql_error()); // fetch associated: get function from a query for a database $dbpass = $row['PassWord']; // read password of inputted user from the query. $dbuser = $row['UserName']; // read username from the query $dbactive = $row['Active']; // read if user is active $dbid = $row['CustNum']; if($UserP == $dbpass){ if($dbactive == 1){ //set session information $_SESSION['CustNum'] = $dbid; $_SESSION['UserName'] = $dbuser; echo "&lt;br&gt;&lt;br&gt;&lt;center&gt;&lt;b&gt;You have been logged in as &lt;b&gt;$dbuser&lt;/b&gt;. &lt;a href='orderform.php'&gt;Click here&lt;/a&gt; to go to the member page.&lt;/b&gt;&lt;/center&gt;&lt;br&gt;&lt;br&gt;"; } else echo "$form &lt;center&gt;&lt;b&gt;You need to activate your account.&lt;/b&gt;&lt;/center&gt;&lt;/br&gt;"; } else echo "$form &lt;center&gt;&lt;b&gt;You did not enter a correct password.&lt;/b&gt;&lt;/center&gt; &lt;/br&gt;"; } else echo "$form &lt;center&gt;&lt;b&gt;The username you entered was not found.&lt;/b&gt;&lt;/center&gt;&lt;/br&gt; "; mysql_close(); } else echo "$form &lt;center&gt;&lt;b&gt;You must enter your password. &lt;/b&gt;&lt;/center&gt;&lt;/br&gt;"; } else echo "$form &lt;center&gt;&lt;b&gt;You must enter your username. &lt;/b&gt;&lt;/center&gt;&lt;/br&gt;"; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload