Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,056 members, 7,818,163 topics. Date: Sunday, 05 May 2024 at 09:17 AM

Php Error - Any Gist - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Php Error - Any Gist (1415 Views)

How Do I Fix "Player.exe Has Stopped Working" Error Message. / Global Innovation Through Science And Tech (GIST) Initiative Competition 2013 / Php Header() Function Error (2) (3) (4)

(1) (Reply) (Go Down)

Php Error - Any Gist by blacksta(m): 7:29am On Aug 02, 2009
Notice: Use of undefined constant action - assumed 'action' in E:\mysite\documents\questionsLoop.php on line 3

Notice: Undefined index: action in E:\mysite\documents\questionsLoop.php on line 3

Notice: Use of undefined constant action - assumed 'action' in E:\mysite\documents\questionsLoop.php on line 8



I Think i know the solution - but any expert solution would benefit Newbie php developers

Thanks
Re: Php Error - Any Gist by Nobody: 7:23pm On Aug 02, 2009
blacksta:


I Think i know the solution - but any expert solution would benefit Newbie php developers

Thanks

u dont know the solution, thats why u are here

i guess are trying to use action instead of 'action' (in quotes) or action doesn't exist at all
post ur codes let's see.
Re: Php Error - Any Gist by Nobody: 10:44pm On Aug 02, 2009
I recognize the error, but lemme go to the solution. You will only see it offline on your localhost almost all the time.
It is due to a setting in your php. You need to access your php.ini file. I suspect you are using wamp server.

There are 3 ways to solve it, a temporary way it to write:

Method 1: Temporary
<?php
error_reporting(0); //at the begining of your script(s)
echo $_GET['nairaland']; //will not generate errors
?>

Method 2: Temporary - put that isset around all your variables
<?php
echo isset($_GET['nairaland']); //will not generate errors
?>

Method 3: Permanent - the best method

The location of the php.ini vary for each of the servers, IIS, wamp, XAMP, Reactor. . . . . . . . . . . . . . . . , . . .
If you are using wamp, just click on the system tray icon, click on php, click on php.ini

search for error_reporting, then you will come to a line like this:

; - Show all errors, except for notices and coding standards warnings
;
;error_reporting = E_ALL & ~E_NOTICE
;
; - Show all errors, except for notices
;
;error_reporting = E_ALL & ~E_NOTICE | E_STRICT
;
; - Show only errors
;
;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
;
; - Show all errors, except coding standards warnings
;
error_reporting = E_ALL


Notice that ; is used to comment, just comment out that E_ALL, and uncomment the error_reporting = E_ALL & ~E_NOTICE,
so that your config looks like this:


; - Show all errors, except for notices and coding standards warnings
;
error_reporting = E_ALL & ~E_NOTICE
;
; - Show all errors, except for notices
;
;error_reporting = E_ALL & ~E_NOTICE | E_STRICT
;
; - Show only errors
;
;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
;
; - Show all errors, except coding standards warnings
;
;error_reporting = E_ALL


Then restart your server after saving that file. Dont forget to make a backup copy before you
make changes so that you do not scatter it.

If you are still in doubt, check php manual for error_reporting.
Re: Php Error - Any Gist by blacksta(m): 7:45am On Aug 03, 2009
Thanks dhtml Method 3 solved my problem
Re: Php Error - Any Gist by Nobody: 9:44am On Aug 03, 2009
Method one is the best in development environment. The reason is that disabling error reporting in PHP.ini file will give less opportunity to debug your code in your development environment. Instead of getting error where you have gone wrong you get a blank document. However, if you use method 3 in a life server that's ok.
Re: Php Error - Any Gist by Nobody: 12:44pm On Aug 03, 2009
blacksta:

Thanks dhtml Method 3 solved my problem
u are welcome.

cygital:

Method one is the best in development environment. The reason is that disabling error reporting in PHP.ini file will give less opportunity to debug your code in your development environment. Instead of getting error where you have gone wrong you get a blank document. However, if you use method 3 in a life server that's ok.

That method 1 can be modified to - error_reporting(E_ALL ^ E_NOTICE);
so that it has same effect as method 3. And of course all the methods can work, but the best one is the 3rd one.
That is the setting with most online servers, at least all that i have worked with so far.

(1) (Reply)

. / Hello Programmer Need Ur Assistance / Programmers In Kaduna

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 15
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.