my site error please help thanks

Discussion in 'Programming' started by dh86, Jun 8, 2012.

  1. #1
    my error when i load my site, the site is showing but i get...

    Notice: Undefined index: atype in /home/mystatu3/public_html/inc/user.class.php on line 33
     
    dh86, Jun 8, 2012 IP
  2. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #2
    It's not a fatal error...it's a Php warning so the execution of the script will continue. It means you are trying to access a variable or key that doesn't contain a value (meaning it's empty). You are probably using $_GET['atype'] or $_POST['atype'] on line 33 and no value is being passed. To avoid this warning you can use isset().. like so somewhere before calling atype (assuming it's accessed via GET method):

    if (!isset($_GET['atype'])) $_GET['atype'] = "";

    Or...

    $atype = isset($_GET['atype'])) ? $_GET['atype'] : ''; //then use $atype to access the value

    Or...just disable PHP warnings for PRODUCTION

    on top of the script under <?php do something like so:

    $productionMode = 1; // 0: Off - Development; 1: On - Production
    
    if ($productionMode) error_reporting(E_ERROR | E_PARSE);
    PHP:
     
    NetStar, Jun 9, 2012 IP