我有这段 php 代码:
$dcs = mysql_query("SELECT `locations.l_name`, `locations.location_id`
FROM `locations`, `cabinet`
WHERE `locations.location_id` = `cabinet.datacentre_id`
GROUP BY `locations.location_id`
ORDER BY `locations.l_name`");
while ($row = mysql_fetch_array($dcs)) {
echo '<option value="' .$row['location_id']. '">' .htmlspecialchars($row['l_name']). '</option>'; }
但是当我运行它时,我得到了这个错误:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
我很确定这是数据库的问题,而不是代码的问题。任何想法可能是什么问题?或者我需要注意什么?