嗨,我的代码如下。更新多个记录mysql
我想要做的是更新mysql中满足特定特定条件的所有值。现在,当我只需键入mysql查询:
UPDATE `$DBNAME`.`video` SET `Secret_key` = '0'
该查询工作正常,但我似乎无法编写将执行此操作的PHP代码。 任何帮助,欢迎
<?php
// Part 1 (works fine)
include("/home3/kintest2/public_html/include/config.local.php");
$connect= mysql_connect ($DBHOST,$DBUSER,$DBPASSWORD);
$select= mysql_select_db($DBNAME, $connect);
// End of Part 1
// Part 2 (works fine)
$test2= "SELECT * FROM `video`";
$results= mysql_query($test2, $connect);
$num_rows = mysql_num_rows($results);
// End of part 2
// Part 3 (Not too sure about this part)
for ($num_rows= $count; $count >= 0; $count--)
{
mysql_query("UPDATE `$DBNAME`.`video` SET `Secret_key` = '0'",$connect);
}
// End of part 3 (Not too sure about this part)
?>
谢谢它的作品:) – 2012-07-20 03:33:40