Question mark character in PEAR prepare causes "insufficient data supplied" error
| From: | Ken Stuart | Date: | Wed, 22 Jan 2003 20:20:32 +0000 |
| Subject: | Question mark character in PEAR prepare causes "insufficient data supplied" error | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-3410@lists.php.net to get a copy of this message | ||
Hello,
This problem seems very strange, so perhaps it's a bug in PEAR, but I thought it worth asking about before reporting.
When trying to update a MySQL database via web page, the PHP script inserts data successfully when the SQL is:
INSERT INTO stories VALUES (NULL, '4th try', 'Does this work', 'kps1', NOW(), 1)
But it fails to insert data when it is:
INSERT INTO stories VALUES (NULL, '4th try', 'Does this work?', 'kps1', NOW(), 1)
and results in the message:
DB Error: insufficient data supplied
The only change here is the addition of the question mark character. The same bad result happens if I change the question mark character to &63; or try escaping it before executing the insert command.
The problem apparently comes from this line: $query = $db->prepare($sql) and it happens with different databases via different web page form where $db is already open and working fine, and $sql is the insert command shown above.
If I copy the non-working SQL line into a MySQL prompt it works fine, so the problem seems to be the PEAR command rather than the SQL command itself.
If you have any suggestions on why the question mark character results in the error message (or can confirm whether this is a bug) and can e-mail me directly as well as replying to the list, I'd be much obliged.
-Ken
kps1@csun.edu
Using:
PEAR.php,v 1.13.2.4 2001/11/13 01:26:39
PHP Version 4.1.2
MySQL 3.23.49
Linux lachesis 2.2.20, Debian and Apache
[end message]
Ken Stuart
On-line Teaching Consultant
Information Technology Resources, 250 Sequoia Hall, mail drop 8280
California State University, Northridge, CA 91330-8280
(818) 677-6654; kps1@csun.edu