Query would run directly on MySQL but not through PHP -


i have simple mysql query

select * tutor verified = 0 , alert_by < '2015-08-05' limit 0,1 

now, running directly through phpmyadmin provides desired results, however, when query being executed through set of php statements, doesn't return anything. below code in php

$this_date = date("y-m-d");  $query = "select * tutor verified = 0 , alert_by < '$this_date' limit 0,1";  $contact = mysqli_query($conn, $query); $row = $contact->fetch_array(mysqli_assoc); 

however, $row empty, can't seem figure out. know seems trivial, little annoying.

note: removing "and alert_by < '$this_date'" query, works fine.

check

  1. connection

    $con = mysqli_connect("localhost","my_user","my_password","my_db");  if (mysqli_connect_errno()) {     echo "failed connect mysql: " . mysqli_connect_error(); } 
  2. use mysqli_query

    $contact = mysqli_query($con,"select * tutor verified = 0 , alert_by < '$this_date' limit 0,1"); 
  3. use fetch array (example #2 procedural style)

    $row = mysqli_fetch_array($contact, mysqli_assoc) 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -