我有一个表格,其中列名称为{1,2,3 ...,31}。我试图像这样插入值:
如果$ today_date == $ column_element 然后 插入table_name($ today_date)值(' present');
这是可能的吗?
$ sql = mysql_query(" SELECT * FROM employeeattaindence ORDER BY RAND()LIMIT 1")或死亡("错误");
$date = date("y-m-d");
$extract_date = explode("-", $date);
//echo "<br/>Today date is : " . $extract_date[2];
while ($row = mysql_fetch_assoc($sql)) {
if($row[$extract_date[2]] == ''){
//echo "You were <b> Absent </b> on" . $extract_date[2];
mysql_query("INSERT INTO employeeattaindence (".$extract_date[2].") VALUES ('Present')") or die("<br/>Error");
}