RE: Re: mysqli sql question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx] 
Sent: Wednesday, August 31, 2011 9:18 AM
To: php-general@xxxxxxxxxxxxx
Subject:  Re: mysqli sql question

"Jen Rasmussen" <jen@xxxxxxxxxxxxxxxx> 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




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux