Skip to main content
Known Participant
January 9, 2023
Answered

PHP Warning: Use of undefined constant Type

  • January 9, 2023
  • 3 replies
  • 2289 views

Hi
I have run to check error logs on my coding. 
However, it appears 

PHP Warning:  Use of undefined constant Type 

 

May i know does it mean?
Since the files only works in localhost, when i tried in server, error appears.

    This topic has been closed for replies.
    Correct answer osgood_

    What version of php are you running on your local server and what version are you running on the remote server?

     

    I see in the select query you are using a lower case p for your product table name whereas your database table l think uses a capital P for Products  Try to be consistant otherwise any minor deviation could cause issues. Think about if youre getting the id from the url parameter. If you have problems hard code an id in the query string as a test or echo the id out to see if it contains anything.

     

    Also l would wrap ALL of your database column names in string tags - $row['Pic'] , $row['Pic1'] etc  - php is not forgiving, anything missing and the page will usually die.

     

    Check if the version of php on the remote server is compatible with the short php echo statement that your code uses.

     

    The page is being parsed as it outputs the skeleton html code structure so something within the php is not correct or your remote server is not set up correctly to output php.

    3 replies

    Brainiac
    January 9, 2023

    The code is probably looking for a string ' ' Try wrapping [id] in a string in your $_GET method ['id']

     

    $id = $_GET['id']

    Known Participant
    January 10, 2023

    Thanks for your suggestion.
    However, the coding only works in localhost. When i upload the files to the server, then the content cannot be shown.


    I have asked the server side, is there any error mistake. However, they said they cannot find out any problem from server.
    So im wondering is there any differnt code needed when we use under server.

    osgood_Correct answer
    Brainiac
    January 10, 2023

    What version of php are you running on your local server and what version are you running on the remote server?

     

    I see in the select query you are using a lower case p for your product table name whereas your database table l think uses a capital P for Products  Try to be consistant otherwise any minor deviation could cause issues. Think about if youre getting the id from the url parameter. If you have problems hard code an id in the query string as a test or echo the id out to see if it contains anything.

     

    Also l would wrap ALL of your database column names in string tags - $row['Pic'] , $row['Pic1'] etc  - php is not forgiving, anything missing and the page will usually die.

     

    Check if the version of php on the remote server is compatible with the short php echo statement that your code uses.

     

    The page is being parsed as it outputs the skeleton html code structure so something within the php is not correct or your remote server is not set up correctly to output php.

    BenPleysier
    Community Expert
    January 9, 2023
    Known Participant
    January 9, 2023

    i have a problem on different display between in localhost and server.

    The coding seem has no error appears, the website run normal in localhost.


    But when i uploaded the files in server, i dont understand why the page cannot run as normal in localhost.


    BenPleysier
    Community Expert
    January 9, 2023

    Please supply the URL to the site.

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
    Known Participant
    January 9, 2023
    PHP Warning:  Use of undefined constant Type - assumed 'Type' (this will throw an Error in a future version of PHP) 
    PHP Warning:  Use of undefined constant Type - a
    PHP Warning:  Use of undefined constant Typename - assumed 'Typename'