我有一个问题,我的脚本有三个mysql_query
应该一个接一个使用,我正在尝试创建一个脚本,通过将其状态从已售出 =“否”更改为“是”来预订门票,该脚本计算用户拥有的门票数量在 html 表单上输入,该表单为服务器端提供了一个变量,其中包含名为 = 的票数$tickets
。
提示:这是一个模型,所以不需要 mysql 注入安全性
这是我的代码:
//get ticket status
$eventTicket = mysql_query("SELECT eventTickets FROM beventreservation WHERE eventId = '$eventId'") or die(mysql_error());
$ticketrow = mysql_fetch_array($eventTicket) or die(mysql_error());
//test... which is working !
echo $ticketrow['eventTickets'];
//get classId from classes
$selectClass = mysql_query("SELECT classId FROM quotaclasses WHERE className = '$classes' AND eventFK = '$eventId'") or die (mysql_error());
$classrow = mysql_fetch_array($selectClass) or die(mysql_error());
//this var is to define which class the user used
$choosedClass = $classrow['classId'];
//test ... which did not work !!!
echo $classrow['classId'];
if ($ticketrow['eventTickets'] == "Yes")
{
for($counter=1;$counter<$numberOfTickets;$counter++)
{
$bookTicket = mysql_query("UPDATE unites SET ticketSold = 'Yes' WHERE businessreservationIdFk = '$eventId' AND classIDfk ='$choosedClass'") or die(mysql_error());
echo "ticket ". $counter . " done !";
}
}
该脚本没有获取此语法,并且我的页面上没有显示错误!
$classrow = mysql_fetch_array($selectClass) or die(mysql_error());
另外,我试图$tickets
在这个语法之后回显变量,它没有出现,在同一个脚本页面上获取超过 mysql_query 是否有问题?请告诉我我哪里出错了。