Note that there are some explanatory texts on larger screens.

plurals
  1. POI have a problem with mysql and php
    primarykey
    data
    text
    <p>I have a problem, this is my code:</p> <pre><code> $db = new mysqli("localhost", "root", "", "blah"); $result1 = $db-&gt;query("select * from c_register where email = '$eml' and password = '$pass'"); if($result1-&gt;fetch_array()) { $auth-&gt;createSession(); $_SESSION['user'] = 'client'; promptUser("You have successfully logged in!!!","index.php"); } $db = new mysqli("localhost", "root", "", "blah"); $result2 = $db-&gt;query("select * from b_register where email = '$eml' and password = '$pass'"); if($result2-&gt;fetch_array()) { $auth-&gt;createSession(); $_SESSION['user'] = 'business'; promptUser("You have successfully logged in!!!","index.php"); } $db = new mysqli("localhost", "root", "", "blah"); $result3 = $db-&gt;query("select * from g_register where email = '$eml' and password = '$pass'"); if($result3-&gt;fetch_array()) { $auth-&gt;createSession(); $_SESSION['user'] = 'employee'; promptUser("You have successfully logged in!!!","index.php"); } $db = new mysqli("localhost", "root", "", "blah"); $result4 = $db-&gt;query("select * from k_register where email = '$eml' and password = '$pass'"); if($result4-&gt;fetch_array()) { $auth-&gt;createSession(); $_SESSION['user'] = 'super'; promptUser("You have successfully logged in!!!","index.php"); } else { promptUser("Username/Password do not match. Please try again!!!",""); } </code></pre> <p>Funny enough this code works, but I no that I went about it the wrong way. I am new with php and mysql, so please help. I also tried e.g<code>result4-&gt;free();</code> for all the variable that save the data, and I got this error: <strong>Fatal error: Call to a member function free() on a non-object in...</strong></p>
    singulars
    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.
    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