Note that there are some explanatory texts on larger screens.

plurals
  1. POMYSQL slow queries with PHP
    primarykey
    data
    text
    <p>I'm using mysql and php for registration on my web-site. Registration is ok. Mysql do queries immediately. But in login there strange things begin to happen. I insert a test in my php code to insert test row to database. First test code inserted immediately, but 2nd was inserted after series of refresh and relog actions only after 10 minutes. The 3rd test query is the same-after approximately 10 minutes after 2nd query.</p> <p>Here is login code:</p> <pre><code>&lt;?php session_start(); if(isset($_SESSION['id'])){ echo 'You have logged in.'; echo $_SESSION['id']; } else { $email=$_POST['email']; $password=$_POST['password']; $db=new mysqli('','','',''); if (mysqli_connect_errno()) { echo 'Unable to connect to database: '.mysqli_connect_error().'. Please e- mail our system administrator. We will fix this error as soon as possible. Thanks for patience and understanding. '; exit(); } //TEST QUERY $query="insert into test values(3, 'test')"; $result=$db-&gt;query($query); //LOGIN QUERY $query="select id from users where email='$email' and password='$password'"; $result=$db-&gt;query($query); if ($result-&gt;num_rows==0) { echo 'Incorrect email or password.'; } else { $row=$result-&gt;fetch_assoc(); $_SESSION['id']=$row['id']; echo 'You have logged in.'; echo $_SESSION['id']; //THIS TEST QUERY IS NOT IMPLEMENTED $query="insert into test values(1, test)"; $result=$db-&gt;query($query); } } ?&gt; </code></pre> <p>Where is mistake?</p> <p>Test table consists of 2 columns: id (medium int, primary key, unsigned) and test(text)</p> <p>Thanks in advance.</p>
    singulars
    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.
    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