Php While循环仅显示一条记录

时间:2015-10-05 23:49:19

标签: php

我正在尝试浏览数据库中的每条记录并更新行。它有效,但一次只能有一个。

    $con = mysql_connect('localhost', 'root', 'root');
    mysql_select_db('webinar', $con);       
    $result = mysql_query("SELECT * FROM register WHERE mon=0 AND 1hour=0 AND 10min=0 AND wed=0 AND complete=0");
        while ($row = mysql_fetch_assoc($result)) {
            echo $row['email'];
            $res = "UPDATE register SET mon=1 WHERE id=".$row['id']."";
            $result = mysql_query($res);
        }

1 个答案:

答案 0 :(得分:0)

跑步

this.comboBox1.DataSource = yourdatatable;
this.comboBox1.DisplayMember = "Key";
this.comboBox1.ValueMember = "Value";

示例:

for(int i=0; i<dtCustomer.Rows.Count();i++)
{
    comboBox1.Items.Add(new ListItem(dtCustomer.Rows[i][0], dtCustomer.Rows[i][1]))
}