Re: [PHP-DB] Prepared Statements

2011-11-12 Thread tamouse mailing lists
On Fri, Nov 11, 2011 at 10:41 AM, Ron Piggott ron.pigg...@actsministries.org wrote: ?php $dsh = 'mysql:host=localhost;dbname='.$database; $dbh = new PDO($dsh, $username, $password); #query for the authorization code $query = SELECT `authorization_code` FROM

Re: [PHP-DB] Need help with updating existing mysql records with something else

2011-11-12 Thread tamouse mailing lists
2011/11/11 Amit Tandon att...@gmail.com: U can update the record with following === $result = mysql_query(UPDATE  tax set mwool40_ totqty = $res, $connection) or die(error updating database); Won't this update every row in the table? I think you'd want: $result =

[PHP-DB] question about best practice for coding sql statements

2011-11-12 Thread tamouse mailing lists
I'm curious how others feel about this. When I'm creating an SQL string, either for a non-prepared or prepared execution, I build it in a variable and then pass the variable to the query or prepare function. This lets me easily add something to view the SQL statement, and also if there's an error,