mysql - How to set column value as variable in msaccess php -


my query :

$att="select       attdata.rollno,attdata.name,attdata.year,attdata.sec,attdata.".$date."        attdata attdata.sec='".$sec."' , attdata.dept='".$dept."'        ,  attdata.year='".$year."' , attdata".$date."='ab'  "; 

my database design view

enter image description here

my error

warning: odbc_exec() [function.odbc-exec]: sql error: [microsoft][odbc microsoft access driver] syntax error (missing operator) in query expression 'attdata.sec='a' , attdata.dept='cse' , attdata.year='iv' , attdata'02-07-2016'='ab' ''., sql state 37000 in sqlexecdirect in c:\wamp\www\sms1.7.16\repotdaygen_allyear.php on line 325 select invalid37000

try ...i added square brackets around $date in 2 spots

$att="select       attdata.rollno,attdata.name,attdata.year,attdata.sec,attdata.[".$date."]        attdata attdata.sec='".$sec."' , attdata.dept='".$dept."'        ,  attdata.year='".$year."' , attdata[".$date."]='ab'  "; 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -