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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -