Re: [PHP-DB] Prepared Statements

2011-11-12 Thread tamouse mailing lists
On Fri, Nov 11, 2011 at 10:41 AM, Ron Piggott wrote: > > $dsh = 'mysql:host=localhost;dbname='.$database; > $dbh = new PDO($dsh, $username, $password); > > #query for the authorization code > > $query = "SELECT `authorization_code` FROM > `directory_listing_update_authorizations` WHERE NOW() BET

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 : > 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 = mysql_query("UPDATE ta

[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,