function update($data, $table, $id)
{
global $conid;
//echo $id;
/*Assuming array keys are = to database fileds*/
if (count($data) > 0) {
foreach ($data as $key => $value) {
$value = mysqli_real_escape_string($value); // this is line shows a warning
$value = "'$value'";
$updates[] = "$key = $value";
}
}
$implodeArray = implode(', ', $updates);
$sql = ("UPDATE $table SET $implodeArray WHERE id=$id");
mysqli_query($conid, $sql);
}
這是所有表單的更新代碼,但它會給出警告。警告只顯示在該行的其他作品完美的我沒有找到爲什麼會發生..mysqli在php中獲取更新數據的警告
什麼是警告信息嗎? –
警告:mysqli_real_escape_string()正好期待2個參數 – Shri