473,320 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
3 2492
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: DavidPL | last post by:
Hello, I have some problem with bind method in PDO on Oracle with clob | long column type. I have table named TEST_TABLE where I have two columns: ID (int 10, 0) and TEXT (varchar 4000 or long...
2
by: amygdala | last post by:
Hi, I am having an awful lot of trouble of getting the PDO layer to work properly. example code: ----------------- $tmpArray = array ( ':table' ='session', ':id' ='4364564574574576',
3
by: amygdala | last post by:
Hi, Can anyone recommend some extensive PDO documentation? Especially documentation that describes PDO's security capabilities. For instance what measurements does the PDO::prepare take to...
2
by: amygdala | last post by:
Hi, I'm trying to get the following code to work: $sql = 'SELECT name FROM ' . DB_TABLE_CITY . ' WHERE country_id = :countryId AND name LIKE ":city%" LIMIT 10'; $sth = $dbh->prepare( $sql );...
5
by: nephish | last post by:
hey there, can anyone tell me if this is legal php/mysql ? i am trying to write a simple function to get a single stat from a single table. eg.. $field = 'phone_number'; $customer = 'fred';
0
by: mrfabulous | last post by:
I have the following code and it works fine. However since I have overlapping col names in my table, I want $row to include the tableName in the keys of the resulting assoc array. I don't want to...
3
by: Rowan | last post by:
When I run a small test script I get the following error. ___________________________ PHP Fatal error: Call to a member function prepare() on a non-object in /usr/local/lib/php5/pg_connect.php on...
3
by: Gilles Ganault | last post by:
Hi APC doesn't like it when I store the output of a SELECT: === include("apc.php"); $dbh = new PDO("sqlite:./test.sqlite"); $sql = "CREATE TABLE IF NOT EXISTS mytable (name TEXT)";
5
by: Gilles Ganault | last post by:
Hello I use the prepare/execute combo to generate SQL statements. Is it possible to actually see what PDO creates with prepare()? ======= $sql = "INSERT INTO mytable (id, label) VALUES...
16
by: whitep8 | last post by:
Hi all, Im busy trying to move from archaic php to lovely OO php, but i have hit a hurdle. The following two scripts connect, request data to be inserted, and is meant to store it, but it...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.