$cteachers = mysql_query("SELECT * FROM teachers WHERE teachers.stats = '1'") or die(mysql_error());
while($info = mysql_fetch_array($cteachers))
{
Print "<li><strong>$info['id'];</strong></li><li><strong>$info['name'];</strong></li>"<li><strong>$info['rnk'];</strong></li>;
$id = $info['id'];
$cnme = $info['name'];
$fnme = $info['f_name'];
$lnme = $info['l_name'];
$rnkk = $info['rnk'];
$fullname = $fnme." ".$lnme;
if ($cnme == '')
{
$que2 = "UPDATE teachers (name) VALUES('$fullname') WHERE teachers.f_name = '"$fnme"' AND teachers.l_name = '"$lnme"'" or die(mysql_error());
$exe2 = mysql_query($que2) or die(mysql_error());
}
你好,我現在面臨一個問題,請大家幫我將提供教師,但的完整列表,如果老師全名字段爲空,則更新如何更新表通過if條件時while循環
@Prix是正確的。你可以像'UPDATE ... SET ... = ...' –
這樣做,並在打印前進行更新:)否則,它會首先打印空白,然後更新。但我建議先執行Kickstart的答案查詢,然後執行這個查詢,你說 – Fallen
我迷路了。你想做什麼? – Strawberry