PHP Openlink/Progress Problems
| From: | Grant Walters | Date: | Tue, 23 Oct 2001 07:05:26 +0000 |
| Subject: | PHP Openlink/Progress Problems | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-71905@lists.php.net to get a copy of this message | ||
I'm going nuts trying to work out how to handle errors from data statement with single quotes.
PHP 4.0.6 appears to be mangling
something somewhere.
All statements work with the Openlink odbctest program
Any help appreciated
<?
$conn = odbc_connect("$dsn","","","$cursor");
$sql="SELECT ID,Category,description FROM card_type WHERE description='IMPEYS'";
echo "<BR><b>SQL:</b> $sql<BR>";
$results = odbc_do($conn,$sql);
if ($results) {
while (odbc_fetch_into($results,$row)) {
echo $row[0]." ".$row[1]." ".$row[2]."\n";
}
}
$sql="SELECT ID,Category,description FROM card_type WHERE description LIKE
'%PEP%'";
echo "<BR><b>SQL:</b> $sql<BR>";
$results = odbc_do($conn,$sql);
if ($results) {
while (odbc_fetch_into($results,$row)) {
echo $row[0]." ".$row[1]." ".$row[2]."\n";
}
}
$sql='SELECT ID,Category,description FROM card_type WHERE description LIKE
"%PEP%"';
echo "<BR><b>SQL:</b> $sql<BR>";
$results = odbc_do($conn,$sql);
if ($results) {
while (odbc_fetch_into($results,$row)) {
echo $row[0]." ".$row[1]." ".$row[2]."\n";
}
}
$sql='SELECT ID,Category,description FROM card_type WHERE
description="PEPPERELL\'S"';
echo "<BR><b>SQL:</b> $sql<BR>";
$results = odbc_do($conn,$sql);
if ($results) {
while (odbc_fetch_into($results,$row)) {
echo $row[0]." ".$row[1]." ".$row[2]."\n";
}
}
$sql="SELECT ID,Category,description FROM card_type WHERE
description=\"PEPPERELL'S\"";
echo "<BR><b>SQL:</b> $sql<BR>";
$results = odbc_do($conn,$sql);
if ($results) {
while (odbc_fetch_into($results,$row)) {
echo $row[0]." ".$row[1]." ".$row[2]."\n";
}
}
?>
OUTPUT
------
SQL: SELECT ID,Category,description FROM card_type WHERE description='IMPEYS'
355 Other Item IMPEYS
SQL: SELECT ID,Category,description FROM card_type WHERE description LIKE '%PEP%'
177 Other Item PEPPERELL'S
SQL: SELECT ID,Category,description FROM card_type WHERE description LIKE "%PEP%"
Warning: SQL error: [OpenLink][ODBC][Driver]Syntax error or access, SQL state 37000 in SQLExecDirect
in
/usr/local/.WWW/WEBS/_odbc/test.php3 on line 42
SQL: SELECT ID,Category,description FROM card_type WHERE description="PEPPERELL'S"
Warning: SQL error: [OpenLink][ODBC][Driver]Syntax error or access, SQL state 37000 in SQLExecDirect
in
/usr/local/.WWW/WEBS/_odbc/test.php3 on line 50
SQL: SELECT ID,Category,description FROM card_type WHERE description="PEPPERELL'S"
Warning: SQL error: [OpenLink][ODBC][Driver]Syntax error or access, SQL state 37000 in SQLExecDirect
in
/usr/local/.WWW/WEBS/_odbc/test.php3 on line 58
Regards
Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989