php mysql fetch语句提取问题

i have a problem my script has three mysql_query which should be used after each other , i am trying to create a script that reserve tickets by changing their status from sold = "No" to "Yes", the script count the number of tickets user has entered on html form which give the server side a variable with number of tickets called = $tickets.

hint : this is such a model so no need for mysql injection security

here is my code :

//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 !";


        }

    }

the script doesn't fetch this syntax, and there is no errors showed on my page !

$classrow = mysql_fetch_array($selectClass) or die(mysql_error());

also , i tried to echo the variable $tickets after this syntax , it did not showed up, is there a problem to fetch more than mysql_query on the same script page ? tell me where do i go wrong here please .

Don't call die() in conjunction with a mysql_fetch_*() call. If there are no rows returned, mysql_fetch_array() returns FALSE, which triggers your die() and kills your script even though there was no error. Since you have already don error checking on $selectClass in the mysql_query() call, you know it has succeeded.

// This query returned no rows, but was successful syntactically and functionally.
$selectClass = mysql_query("SELECT classId FROM quotaclasses WHERE className = '$classes' AND eventFK = '$eventId'") or die (mysql_error());    

Instead, test if rows were returned:

if (mysql_num_rows($selectClass) > 0) {
  // Fetch and do other stuff
   $classrow = mysql_fetch_array($selectClass);
   $choosedClass = $classrow['classId'];
   // etc...
   // etc...
}
else {
  // Do whatever you need to do if no rows return
}