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
https://forums.phpfreaks.com/topic/214812-notice-undefined-variable/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.