1
我試圖動態更新一個MySql表,$query
看起來正確時,我回聲它,但由於某種原因,當我將代碼插入MySql查詢時,它不起作用。動態更新MySql表
$b = 1;
$query_a = array();
$vars = array();
$result = mysql_query("SELECT * FROM my_table");
for ($i = 0; $i < mysql_num_fields($result); $i++) {
$vars[] = mysql_field_name($result,$b);
$b++;
}
foreach ($vars as $v)
{
if (isset($_GET[$v]))
{
$isclean = $_GET[$v];
$query[] = $v.' = '.$isclean.'';
}
}
$query = implode(',', $query);
mysql_query("UPDATE my_table SET $query WHERE UIN = '1'");
它給了什麼錯誤? – encodes 2012-04-13 11:02:11
make echo mysql_error();如果有什麼問題 – riso 2012-04-13 11:02:11