mysql - Dynamic variable not working in php -
i cant declare dynamic variable. hardcoded variable working. have code reads .mdb file. working when values hardcoded when make values dynamic doesnt work. using double , single quote working when defining in variable without quotes. working code is
$userid = "91"; $sensorid = "1"; $conn = new com("adodb.connection") or die("adodb oops!"); $conn->open("driver={microsoft access driver (*.mdb)};dbq=c:\standard\att2003.mdb"); $data = $conn->execute("select * checkinout userid = '".$userid."' , sensorid = '".$sensorid."' order checktime desc");
it doenst work if declare $userid = $userdetails['fingerprintid'];
i can assure im getting right value when using $userdetails['fingerprintid'];
this error
fatal error: uncaught exception 'com_exception' message 'source: microsoft ole db provider odbc drivers
description: [microsoft][odbc microsoft access driver] not valid bookmark.' in c:\xampp\htdocs\pages\attendance.php:21 stack trace: #0 c:\xampp\htdocs\pages\attendance.php(21): com->execute('select * c...') #1 c:\xampp\htdocs\reception.php(51): include('c:\xampp\htdocs...') #2 {main} thrown in c:\xampp\htdocs\pages\attendance.php on line 21
will update question later think problem not syntax rather database. im getting error particular user trying other user using $userid = $userdetails['fingerprintid'] working.
your ids seem numeric, try:
$data = $conn->execute("select * checkinout userid = ".$userid." , sensorid = ".$sensorid." order checktime desc");
Comments
Post a Comment