By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,890 Members | 1,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,890 IT Pros & Developers. It's quick & easy.

$pdo->prepare($sql) with "?"

P: n/a
Could you please help me:
$sql = "SELECT qualityId FROM quality WHERE qualityName = 'VVS'";
$r = $d->selectQueryQuality($sql);
$sql = "INSERT INTO stones (size, price, qualityId) VALUES(?,?,$r)";
$c->insertMySQL($sql, 9, 14, 3, 18, $check );

As you see in the 3rd statement, I'm trying to use instead of the 3rd
question mark a variable, but this gives me an error: Could not
prepare query: INSERT INTO stones (size, price, qualityId)
VALUES(?,?,)
The error shows that at the last position there's no ? (of course),
but also no value.

How can I make that the value shows up there and how can I make that I
can execute the $pdo->prepare if in one place there's a value instead
of "?"?
Thanks a lot for your help.
Sep 15 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
12******@gmail.com schreef:
$r = $d->selectQueryQuality($sql);
To state the obvious: print out $r to see if it actually contains a value.
JW
Sep 15 '08 #2

P: n/a
On Sep 15, 5:33 pm, Janwillem Borleffs <j...@jwscripts.comwrote:
123be...@gmail.com schreef:
$r = $d->selectQueryQuality($sql);

To state the obvious: print out $r to see if it actually contains a value.

JW
You're right, thanks a lot!
Sep 15 '08 #3

P: n/a
On Sep 15, 5:33 pm, Janwillem Borleffs <j...@jwscripts.comwrote:
123be...@gmail.com schreef:
$r = $d->selectQueryQuality($sql);

To state the obvious: print out $r to see if it actually contains a value.

JW
You're right, thanks a lot!
Sep 15 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.