无法使用PHP变量列名称来更新SQL中的列 [英] Unable to use a PHP variable column name to update a column in SQL
本文介绍了无法使用PHP变量列名称来更新SQL中的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
mysql_query("UPDATE students SET '. $rollno .' = '1'
WHERE Faculty_id = $id AND date = $date");
$ROLLONO
是不会更新的列的名称.
$ROLLONO
is the name of the column which doesn't get updated.
推荐答案
我认为您正在动态使用列名,并且您想要:
I think you are dynamically using column name and you want :
mysql_query("UPDATE students SET ". $rollno ." = '1' WHERE Faculty_id = $id AND date = $date");
这篇关于无法使用PHP变量列名称来更新SQL中的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文