database - PDO PHP Multiple Rows update doesn't update -
for record list script i've made form should updating 20 rows @ once, possible change whole list @ one. values retrieved $_post , should updated in database pdo. when click submit-button, nothing happends. doesn't give error, , doens't update value in database.
maybe u can help? lots of in advance.
axel
the script:
<?php if ($_server['request_method'] == 'post') { $dw = $_post['dw']; $vw = $_post['vw']; $aw = $_post['aw']; $titel = $_post['titel']; $artiest = $_post['artiest']; $a = count($dw); $conn = new pdo('mysql:host=localhost;dbname=#dbnamr', '#dbuser', '#dbpass'); try { $set_details = "update `top20` set `vw` = :vw, `aw` = :aw, `titel` = :titel, `artiest` = :artiest `dw` = :dw"; $sth = $conn->prepare($set_details); $i = 0; while($i < $a) { $sth->bindparam(':dw', $dw, pdo::param_int); $sth->bindparam(':vw', $vw, pdo::param_int); $sth->bindparam(':aw', $aw, pdo::param_int); $sth->bindparam(':titel', $titel, pdo::param_str); $sth->bindparam(':artiest', $artiest, pdo::param_str); $sth->execute(); $i++; } } catch(pdoexception $e) { echo "i'm sorry, there error updating database."; echo $e->getmessage(); } $conn = null; } ?>
Comments
Post a Comment