vishwa008 Posted April 25, 2012 Share Posted April 25, 2012 Hi ; Im getting the below error from Access database please help me to fix it. [root@db_cesar home]# php test.php table name : t_b_Door column name : f_DoorID t is not a table in this database Error at Line : syntax error near _ PHP Warning: odbc_exec(): SQL error: [unixODBC]Couldn't parse SQL , SQL state 08001 in SQLExecDirect in /home/test.php on line 15 This is my code <?php $conn=odbc_connect("logindb","",""); if (!$conn) { exit("Connection Failed: " . $conn); } $sql="SELECT f_ReaderID FROM t_b_Reader"; $rs=odbc_exec($conn,$sql); if (!$rs) { exit("Error in SQL"); } while (odbc_fetch_row($rs)) { $f_ReaderID=odbc_result($rs,$f_ReaderID); //$conname=odbc_result($rs,"ContactName"); echo "$f_ReaderID \n"; } odbc_close($conn); ?> Thanks Link to comment https://forums.phpfreaks.com/topic/261575-php-access-db-coding-issue/ Share on other sites More sharing options...
Jessica Posted April 25, 2012 Share Posted April 25, 2012 Wild guess, try putting the table name (and column names maybe) in backticks $sql="SELECT f_ReaderID FROM `t_b_Reader`"; Also please use code tags, not bold/italics etc. Link to comment https://forums.phpfreaks.com/topic/261575-php-access-db-coding-issue/#findComment-1340415 Share on other sites More sharing options...
Muddy_Funster Posted April 25, 2012 Share Posted April 25, 2012 Access (because it's s**t) uses square brackets instead of backticks. Best fix would be to use a real database backend and use your Access disk as a skeet. Link to comment https://forums.phpfreaks.com/topic/261575-php-access-db-coding-issue/#findComment-1340421 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.