PHP Code:
$a = array( 'this' => 1,'that' => 2,'the other'=>3, ) ;
// in php a trailing comma is allowed in an array declaration ... see after "3"
// simple query builder based on that array
$qry = 'update table set ' ;
foreach( $a as $k=>$v ){
$qry .= $k . ' = ' . $v . ',' ;
}
$qry = rtrim( $qry , "," );
$qry .= ' where id = 1 ' ;
echo $qry ;
// gives :
// update table set this = 1,that = 2,the other = 3 where id = 1
If you were using some kind of query builder, I would guess you lost a rtrim() somewhere along the line rather than mysql changing how it deals with the rather strict sql statements.
Bookmarks