我有一個簡單的查詢,它從我的數據庫中返回一些結果,它返回 4 行,但是當我執行插入時,它只執行第一行然后停止,似乎沒有為從返回的每一行執行插入第一個查詢。$sql = "SELECT t.ID AS 'TopicID', t.seminar_id AS 'SeminarID', rl.resourceid AS 'ResourceID', r.ResourceType AS 'ResourceType' FROM topic t LEFT JOIN resourcelink rl ON rl.entityid = t.ID LEFT JOIN resources r ON r.ResourceID = rl.resourceid WHERE t.seminar_id = '124840'";$result = mysql_query($sql);// echo "<pre>";// print_r($sql);// echo "</pre>";while($row = mysql_fetch_assoc($result)){ $resourceID = $row['ResourceID']; $resourceType = $row['ResourceType']; if ($resourceID != '' && $resourceType != 1) { $sql_insert = "INSERT INTO resourcelink (resourceid, entityid, entitytype, linkorder, viewinplayer) VALUES ($resourceID, $topicID, 1, 0, 0)"; $result = mysql_query($sql_insert); }}
- 1 回答
- 0 關注
- 124 瀏覽
添加回答
舉報
0/150
提交
取消