Jump to content

Notice: Undefined variable:


DJSnels

Recommended Posts

I'm getting the following notice:

Notice: Undefined variable: TotaalBerichten in

C:\Users\Sander\Documents\**********************\index.php on line 60

Is it because it is in the IF?

The code:

        //Aantal berichten totaal		 
 if (!$ResultTotaalBerichten = @mysql_query("SELECT COUNT(1) FROM " . $db_prefix . "berichten"))
             {$foutmelding .= $Taal['errorConfiguratieFromDB'];}
         else
             {$TotaalBerichten = mysql_result($ResultTotaalBerichten, 0);
             $TotaalPaginas = ceil($TotaalBerichten / $aantalBerichtenPerPagina);}
         @mysql_free_result($ResultTotaalBerichten);

         //Var eersteBericht is het eerste bericht
         if (isset($_GET['eersteBericht']))
             {if (!is_numeric($_GET['eersteBericht']))
                 {$eersteBericht = '0';}
             else{$eersteBericht = $_GET['eersteBericht'];}}
         else{$eersteBericht = '0';}

        // Als er iets mis is met var eersteBericht, dan hem op 0 zetten
        if (($eersteBericht >= $TotaalBerichten) || ($eersteBericht < 0))   ///////////DIT IS LIJN 60
             {$eersteBericht = 0;}

 

EDIT: translated to english  ;)

 

If i modify it to:

$TotaalBerichten=0; /////////////ADDED
        //Aantal berichten totaal		 
 if (!$ResultTotaalBerichten = @mysql_query("SELECT COUNT(1) FROM " . $db_prefix . "berichten"))
             {$foutmelding .= $Taal['errorConfiguratieFromDB'];}
         else
             {$TotaalBerichten = mysql_result($ResultTotaalBerichten, 0);
             $TotaalPaginas = ceil($TotaalBerichten / $aantalBerichtenPerPagina);}
         @mysql_free_result($ResultTotaalBerichten);
echo $TotaalBerichten;   //////////////////////////////////////////////////////////////////////////ADDED
         //Var eersteBericht is het eerste bericht
         if (isset($_GET['eersteBericht']))
             {if (!is_numeric($_GET['eersteBericht']))
                 {$eersteBericht = '0';}
             else{$eersteBericht = $_GET['eersteBericht'];}}
         else{$eersteBericht = '0';}

        // Als er iets mis is met var eersteBericht, dan hem op 0 zetten
        if (($eersteBericht >= $TotaalBerichten) || ($eersteBericht < 0))   ///////////DIT IS LIJN 60
             {$eersteBericht = 0;}

 

The $TotaalBerichten is '0' while there IS a message in the database???

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.