JOIN not working with PHP + ODBC + Microsoft Access

PoppyTwoTime

New Member
I am trying to write a PHP script that plugs into an existing Access Database. If I would be starting from scratch, I would have used MySQL for the job, but because there is an existing MS Access application I am stuck with the database as it is.As of right now, I am trying to get the following PHP Code to work.\[code\]$conn=odbc_connect('buju','','');if (!$conn){ exit("Connection Failed: " . $conn);}$sql="SELECT * FROM Teilnehmer INNER JOIN TeilnWerte ON Teilnehmer.LfdNr = TeilnWerte.Teilnehmer WHERE Teilnehmer.Klasse = '$_POST[klasse]'";$rs=odbc_exec($conn,$sql);echo "\nErrorCode:\n".odbc_error($conn);echo "\nErrorMessage:\n".odbc_errormsg($conn);\[/code\]I am pretty sure, that the problem is in the SQL Query, since it all works fine if I only do \[code\]SELECT * FROM Teilnehmer WHERE Klasse = '$_POST[klasse]' \[/code\]without trying to join the second table.I am using odbc and the Microsoft Access Driver. The Error Code that I get is \[code\]07001\[/code\]. The Error Message is \[code\][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.\[/code\]I have also tried \[code\]SELECT * FROM Teilnehmer, TeilnWerte WHERE Teilnehmer.LfdNr = TeilnWerte.Teilnehmer AND Teilnehmer.Klasse = '$_POST[klasse]'\[/code\]which did not work either.Is there anything that I am doing wrong? Are there certain SQL commands that don't work
 
Back
Top