如何在变量中设置值?
我尝试了“SET checked = 1”,但收到了这个错误:
警告:mysql_fetch_array()期望参数1为资源,
我正在使用mysql / PHP
IF NOT EXISTS
( SELECT *
FROM training2subjects
WHERE trainingID = ".$_GET['trainingID']."
AND subjectID = ".$subIndex["id"]."
)
BEGIN
INSERT INTO training2subjects (trainingID, subjectID)
VALUES (".$_GET['trainingID'].", ".$subIndex["id"]." )
END;
ELSE
SET checked = 1
$query= mysql_query($query);
$index = mysql_fetch_array($query);
$checked = ($query) OR ($index['checked'] == 1) ? "checked" : "";