note 52401 added to function.odbc-connect

From: Date: Fri, 29 Apr 2005 15:42:32 +0000
Subject: note 52401 added to function.odbc-connect
Groups: php.notes 
Request: Send a blank email to php-notes+get-88757@lists.php.net to get a copy of this message
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); ---- Manual Page -- http://www.php.net/manual/en/function.odbc-connect.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52401 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52401&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52401&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52401&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52401&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52401&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52401&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#88757) next »