For anyone having problems with WHERE clauses in their MS Access ODBC requests here?s what I found: SQL requests sent to Access must include quotes around the criteria.
$sel = "SELECT * FROM table1 WHERE cust_id = 'cust1'";
outputs:
SELECT * FROM table1 WHERE cust_id = 'cust1'
And works.
$sel = ?SELECT * FROM table1 WHERE cust_id = cust1?;
outputs:
SELECT * FROM table1 WHERE cust_id = cust1
And doesn?t work.
Here?s the whole block of code:
$conn = odbc_connect("database1","","");
$sel = "SELECT * FROM table1 WHERE cust_id = 'cust1'";
$exec = odbc_exec($conn,$sel);
while($row = (odbc_fetch_array($exec)))
$serv[odbc_result($exec,'label')] = $row;
print_r($serv);