该脚本应从数据库中选择 StaffID,然后将其放入一个数组中,然后我可以从那里将其放入一个变量中,以便在下一个查询中使用。
$query = "SELECT StaffID FROM staff WHERE First_Name = '$db_staff_member_first_name' AND Last_Name = '$db_staff_member_last_name'";
$result = mysql_query($query)
or die(mysql_error());
echo $result;
echo $query + "<br>";
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$db_staffid = $row['staffID'];
}
脚本运行后我得到
'Resource id #4SELECT CustomerID FROM customer WHERE Customer_First_Name = 'Christopher' AND Customer_Last_Name = 'Bennett'Resource id #50'
然后是以下通知:
注意:未定义索引:E:\EasyPHP-12.1\www\Placing_Orders.php 112 行中的staffID
为什么是这样?