Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Let's see if one of those debug queries</p> <pre><code>.... $dbh = new PDO($dsn, $user, $password); function debugQuery($dbh, $querystring, $params) { $dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $dbh-&gt;prepare($querystring); $stmt-&gt;execute($params); echo $querystring, ":&lt;br /&gt;\n"; while ( false!== ($row=$stmt-&gt;fetch(PDO::FETCH_ASSOC)) ) { echo ' ', join(', ', $row), "&lt;br /&gt;\n"; } } debugQuery($dbh, 'SELECT Count(*) as c FROM user', array()); debugQuery($dbh, 'SELECT Count(*) as c FROM user WHERE email=?', array($email)); debugQuery($dbh, 'SELECT Count(*) as c FROM user WHERE wachtwoord=?', array($wachtwoord)); debugQuery($dbh, 'SELECT Count(*) as c FROM user WHERE email=? AND wachtwoord=?', array($email, $wachtwoord)); debugQuery($dbh, 'SELECT Count(*) as c FROM user WHERE email LIKE ? AND wachtwoord LIKE ?', array( '%'.trim($email).'%', '%'.trim($wachtwoord).'%')); $sql = 'SELECT * FROM user WHERE email = :email AND wachtwoord= :wachtwoord'; $stmt = $dbh-&gt;prepare($sql); ... </code></pre> <p>returns something interesting.</p> <p>edit: Doesn't seem so... then let's attack this from another angle</p> <pre><code>$email = 'emailA'; $wachtwoord = 'wachtwoordA'; echo('I have a user: ' . $email . $wachtwoord . '&lt;br&gt;'); //$dbh = new PDO($dsn, $user, $password); $dbh = new PDO("mysql:host=localhost;dbname=test", 'localonly', 'localonly'); $dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // create a temporary table $dbh-&gt;exec('CREATE TEMPORARY TABLE tmp_user ( id int auto_increment, email varchar(32), wachtwoord varchar(32), primary key(id))'); // and fill in exactly the record we're looking for $dbh-&gt;exec("INSERT INTO tmp_user (email, wachtwoord) VALUES ('$email', '$wachtwoord')"); $sql = 'SELECT * FROM tmp_user WHERE email = :email AND wachtwoord= :wachtwoord'; $stmt = $dbh-&gt;prepare($sql); $stmt-&gt;bindParam(':email', $email,PDO::PARAM_STR); $stmt-&gt;bindParam(':wachtwoord', $wachtwoord,PDO::PARAM_STR); $stmt-&gt;execute(); while($row = $stmt-&gt;fetchObject()) { echo($row-&gt;email . ',' . $row-&gt;wachtwoord); $user[] = array( 'email' =&gt; $row-&gt;email, 'wachtwoord' =&gt; $row-&gt;wachtwoord ); } </code></pre> <p>prints <code>I have a user: emailAwachtwoordA&lt;br&gt;emailA,wachtwoordA</code> on my version of php/mysql.</p>
 

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