insert array to mysql db function
Posted
by
ganjan
on Stack Overflow
See other posts from Stack Overflow
or by ganjan
Published on 2011-01-01T17:44:07Z
Indexed on
2011/01/01
17:53 UTC
Read the original article
Hit count: 249
Hi. I have an array where the keys represent each column in my database. Now I want a function that makes a mysql update query. Something like
$db['money'] = $money_input + $money_db;
$db['location'] = $location
$query = 'UPDATE tbl_user SET ';
for($x = 0; $x < count($db); $x++ ){
$query .= $db something ".=." $db something
}
$query .= "WHERE username=".$username." ";
© Stack Overflow or respective owner