Can anyone explain these error messages?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wayneyh
    New Member
    • Mar 2008
    • 67

    #1

    Can anyone explain these error messages?

    I am just starting to teach myself PHP and i have created a script from a book but i get these error messages.

    Notice: Use of undefined constant id - assumed 'id' in C:\wamp\www\pet sathome\seestor e.php on line 21

    Notice: Use of undefined constant cat_title - assumed 'cat_title' in C:\wamp\www\pet sathome\seestor e.php on line 22

    Notice: Use of undefined constant cat_desc - assumed 'cat_desc' in C:\wamp\www\pet sathome\seestor e.php on line 23

    Notice: Use of undefined constant cat_id - assumed 'cat_id' in C:\wamp\www\pet sathome\seestor e.php on line 28

    Notice: Undefined index: cat_id in C:\wamp\www\pet sathome\seestor e.php on line 28

    Under these messages it shows the items of the page correct so i am confused. any help would be appreciated.

    Regards
  • zorgi
    Recognized Expert Contributor
    • Mar 2008
    • 431

    #2
    It looks like you have loads of undefined constants. You can:

    a) make sure those constants are defined

    b) condition your usage of those constants

    c) disable notices in php.ini by setting error_reporting = E_ALL to error_reporting = E_ALL & ~E_NOTICE

    Comment

    • Wayneyh
      New Member
      • Mar 2008
      • 67

      #3
      Thanks i will try those.

      Is there a really basic shopping cart out there for beginners to learn from?

      regards

      Comment

      • zorgi
        Recognized Expert Contributor
        • Mar 2008
        • 431

        #4
        I did installation of PrestaShop and it was very simple strait forward job.

        Also did VirtueMart adaptations but would not recommend unless you are very good with joomla.

        Also might be worth checking http://www.zen-cart.com/. Never worked with it but looks popular.

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          You're not using a string where you should be using one. Consider the following:

          Code:
          $data = array (
            'name' => 'Sarah',
            'age'  => 22
          );
          
          // Wrong
          echo $data[name];
          // Correct
          echo $data['name'];

          Comment

          • oranoos3000
            New Member
            • Jan 2009
            • 107

            #6
            hi my friend
            for write a script and debuging it is better that error_reporting setting in php.ini to be set to E_ALL that show all error , warning , notice and the other but for representing site on the web this is set to what doesnt show notice and warning that can be danerous for site for correct your script you must check this constant is defined or not
            note: writing name of the variable without or forgetting wirte $ create the same error
            note2: constant is defined withe define(name, value)
            and name is not consist of $ and is better write with uppercase letter

            be successful

            Comment

            • Dormilich
              Recognized Expert Expert
              • Aug 2008
              • 8694

              #7
              note2: constant is defined withe define(name, value)
              or
              Code:
              const X = true;
              (though that requires you to follow the constant definition constraints)
              Last edited by Dormilich; Sep 24 '10, 06:04 PM. Reason: corrected constant defining error

              Comment

              • ciranjeebxtreme
                New Member
                • Sep 2010
                • 4

                #8
                I Think You Might Have Not Defined Your CONSTANT Correctly.

                First Try Editing Your CONSTANT By ReDefining It In The Error Lines .
                For syntax:
                define('CONSTAN TNAME','CONSTAN TVALUE');
                For Example :
                define('CONSTAN TID','3214');

                Once You've Rectified Your Constants,Make Some Few Changes In Your php.ini File....
                1.expose_php=of f
                2.display_error s=off
                3.log_errors=on
                The Errors Now Will Be Posted In Your Error Log File Rather Than Viewing It In Your Applications
                4.error_log=fil ename

                Hope This Works....
                If You Find AnyMore Problem...Let Me Know..
                <email removed>
                Last edited by Markus; Sep 24 '10, 04:19 PM. Reason: Removed email

                Comment

                • Wayneyh
                  New Member
                  • Mar 2008
                  • 67

                  #9
                  Thanks for all your help.

                  Comment

                  Working...