سؤال

I have the following:

/* execute multi query */
if ($mysqli->multi_query($query)) {
$n = 0;
do {
    /* store first result set */
    if ($result = $mysqli->store_result()) {
        $i = 1;
        $p = 1;
        while ($row = $result->fetch_row()) {
            print_r($row);
            $n++;
         }
      }
   }
}           
/* close connection */
$mysqli->close();

I am having trouble seeing the wood from the trees - I am getting an 'Unexepected '}'' message - any suggestions?

هل كانت مفيدة؟

المحلول

There is a permanent loop in the do {} sentence. What are you trying to do with it?

You should either remove it or place a real condition:

/* execute multi query */
if ($mysqli->multi_query($query)) 
{
    $n = 0;
    while(CERTAIN CONDITION) 
    {
        /* store first result set */
        if ($result = $mysqli->store_result()) 
        {
        $i = 1;
            $p = 1;
            while ($row = $result->fetch_row()) 
            {
                print_r($row);
                $n++;
            }
        }
    }
}           
/* close connection */
$mysqli->close();
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top