PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB2 » Bug #8538

single quotes in prepared query cause syntax error

Details

Submitted2006-08-22 21:57 UTC
Fromastle at lexi dot net
Assignedlsmith
StatusClosed
PackageMDB2
PHP Version5.1.4
OSirrelevant
Roadmaps(Not assigned)

Comments

[2006-08-22 21:57 UTC] astle at lexi dot net

Description:
------------
Using the mysqli driver and the prepare/execute method of doing a query fails if the prepared query has single quotes in it.

Rewriting the query to parameterize the single-quoted constant allows the query to work as expected. It should not be required to parameterize a constant in a query.

Test script:
---------------
# Assuming a working connection in $db:

$sth = $db -> prepare("SELECT * FROM table WHERE column = 'value' AND othercolumn = ?");

Expected result:
----------------
A usable statement object in $sth

Actual result:
--------------
An error object indicating a "syntax error".