RE: [PHP] Re: mysqli sql question
| From: | Jen Rasmussen | Date: | Wed, 31 Aug 2011 14:33:39 +0000 |
| Subject: | RE: [PHP] Re: mysqli sql question | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-314681@lists.php.net to get a copy of this message | ||
Peet,
Here is the PHP PDO link: http://php.net/manual/en/book.pdo.php
If you look on example #2 on this page:
http://www.php.net/manual/en/pdostatement.execute.php
That is pretty much how it's setup (although the example I gave is update,
this is select).
And please correct me I said the provided code example included named
placeholders, apparently correct terminology is named parameters.
I found this to be a great article as well:
http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-d
atabase-access/
If you need some more example code as well, just let me know. I've been up
to my ears in PDO the last several weeks.
Jen
-----Original Message-----
From: Richard Riley [mailto:rileyrg@googlemail.com]
Sent: Wednesday, August 31, 2011 9:18 AM
To: php-general@lists.php.net
Subject: [PHP] Re: mysqli sql question
"Jen Rasmussen" <jen@cetaceasound.com> writes:
> Peet,
>
> Could you do something like this instead? This is using named placeholders
> and a separate line for your statement
> but I was able to get it to echo the statement in this manner.
>
> $sql = "UPDATE table SET field1=:field1, field2=:field2 WHERE id=:id";
> $sth = $dbh->prepare($sql);
> $sth->execute(array(":field1"=>$field1,
> ": field2"=>$ field2,
> ": id"=>$id));
Hi Jen, could you point me to a document/man page for PHP which explains
that : notation in $sql= line please. I'm sure its common to everyone
here but, well, I never saw it before ;(
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php