0
votes

My query :

$att="select
      AttData.Rollno,AttData.Name,AttData.Year,AttData.sec,AttData.".$date." 
      from AttData where AttData.sec='".$sec."' and AttData.dept='".$dept."' 
      and  AttData.year='".$year."' and AttData".$date."='AB'  ";

my Database design view is

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' and AttData.dept='cse' and AttData.year='IV' and 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

1
yuour issue is probably and AttData".$date."='AB' which becomes and AttData'02-07-2016'='AB' . Not sure what you are trying to do but like this it's plain wrong. What is the name of the column handling 'AB' value ? (I can't open the image from work...) - Thomas G
You need a space in there - Jeff Puckett
column name is '02-07-2016' and value are either AB or P - Mohanaprakash

1 Answers

0
votes

try this ...I added square brackets around $date in two spots

$att="select
      AttData.Rollno,AttData.Name,AttData.Year,AttData.sec,AttData.[".$date."] 
      from AttData where AttData.sec='".$sec."' and AttData.dept='".$dept."' 
      and  AttData.year='".$year."' and AttData[".$date."]='AB'  ";