php - Pdo request, I really don't get it -


juste simple pdo request doesn't work. don't it. don't.

$d = strtotime("today"); $start_week = strtotime("last sunday midnight",$d); $start = date("y-m-d",$start_week);   $s1 = $db->prepare("select leads humeur != 'doublon' , date_import between :start , :end"); $s1->bindparam(':start', $start); $s1->bindparam(':end', $today);  try{   $s1->execute(); } catch (exception $e) {   echo 'exception reçue : ',  $e->getmessage(), "\n"; }  

got that.

exception reçue : sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'where humeur != 'doublon' , date_import between '2015-03-29' , '2015-04-01'' @ line 1

if sees don't, i'll grateful.

your query incorrect, missing table want select from.

you need update query so:

$d = strtotime("today"); $start_week = strtotime("last sunday midnight",$d); $start = date("y-m-d",$start_week);   // replace tablename actual name of table $s1 = $db->prepare("select leads tablename humeur != 'doublon' , date_import between :start , :end"); $s1->bindparam(':start', $start); $s1->bindparam(':end', $today);  try{   $s1->execute(); } catch (exception $e) {   echo 'exception reçue : ',  $e->getmessage(), "\n"; }  

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -