• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

PHP Warning: Use of undefined constant Type

Explorer ,
Jan 09, 2023 Jan 09, 2023

Copy link to clipboard

Copied

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.

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 10, 2023 Jan 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

...

Votes

Translate

Translate
Explorer ,
Jan 09, 2023 Jan 09, 2023

Copy link to clipboard

Copied

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' 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 09, 2023 Jan 09, 2023

Copy link to clipboard

Copied

See https://stackoverflow.com/questions/2941169/what-does-the-php-error-message-notice-use-of-undefined-.... or use Bing to search.

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 09, 2023 Jan 09, 2023

Copy link to clipboard

Copied

i have a problem on different display between in localhost and server.
Screen Shot 2023-01-09 at 19.54.36.png
The coding seem has no error appears, the website run normal in localhost.

Screen Shot 2023-01-09 at 19.55.15.png
But when i uploaded the files in server, i dont understand why the page cannot run as normal in localhost.

Screen Shot 2023-01-09 at 19.56.48.png


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 09, 2023 Jan 09, 2023

Copy link to clipboard

Copied

Please supply the URL to the site.

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 09, 2023 Jan 09, 2023

Copy link to clipboard

Copied

japanfavorite.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 09, 2023 Jan 09, 2023

Copy link to clipboard

Copied

the problem is, when i try to put the unique product details without PHP coding, the page works normal.
so probably there are so mistakes in php coding. However, i have no idea where i did wrong

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 09, 2023 Jan 09, 2023

Copy link to clipboard

Copied

Screen Shot 2023-01-09 at 20.42.26.png

Here is the screenshot of the database.
the product detail is chosen from here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 09, 2023 Jan 09, 2023

Copy link to clipboard

Copied

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

 

$id = $_GET['id']

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 10, 2023 Jan 10, 2023

Copy link to clipboard

Copied

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.

HiuChing26169588pka2_0-1673350922523.png


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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 10, 2023 Jan 10, 2023

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 10, 2023 Jan 10, 2023

Copy link to clipboard

Copied

LATEST

Something in that list of suggestions seems to be correct, care to share what it was?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines