Wampserver (PHP Version 5.3.8) gives error messages where in host (PHP Version 5.2.12) everything is all right
Posted by: goalsurfer (---.47-64-87.adsl-dyn.isp.belgacom.be)
Date: January 27, 2012 03:30PM

(using smarty)

url: [domain] OR [domain]



CODE:

if($_GET['fieldname'] = "" ){
$fieldname = 1;
}else if($_GET['fieldname'] != "" ){
$fieldname = $_GET['fieldname'];
}

$sql = "SELECT * FROM tablename WHERE fieldname = '$fieldname' "; (line 35)
$sql.= "ORDER BY ... ASC";



ISSUE: the if(){}else if(){} gives "Undefined variable: fieldname in C:\wamp\www\...\index.php on line 35"
in wampserver while I use this code everywhere else. Thanks.

Options: ReplyQuote
Re: Wampserver (PHP Version 5.3.8) gives error messages where in host (PHP Version 5.2.12) everything is all right
Posted by: scarabaeus (---.kindermorgan.com)
Date: January 27, 2012 03:54PM

Hello goalsurfer,

Maybe this will help?

[forum.wampserver.com]

regards...

Options: ReplyQuote
Re: Wampserver (PHP Version 5.3.8) gives error messages where in host (PHP Version 5.2.12) everything is all right
Posted by: stevenmartin99 (---.b-ras1.srl.dublin.eircom.net)
Date: January 27, 2012 03:57PM

thats cos your code is incorrect but on a production server - these warning are turned off.

you cant use a variable if it hasnt been defined.

so either fix your code or turn off these warning in wamp


left click wamp> php> php.ini

find

error_reporting = E_ALL

and change to

error_reporting = E_ALL & ~E_NOTICE

save and restart

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Wampserver (PHP Version 5.3.8) gives error messages where in host (PHP Version 5.2.12) everything is all right
Posted by: goalsurfer (---.47-64-87.adsl-dyn.isp.belgacom.be)
Date: January 28, 2012 05:22PM

OK, but I don't see how to change the code. Next:

$fieldname = $_GET['fieldname'];

causes already an error message. How do you handle then strings after the '?' in the url?
(before I turn off error reporting in ini.php)

Options: ReplyQuote
Re: Wampserver (PHP Version 5.3.8) gives error messages where in host (PHP Version 5.2.12) everything is all right
Posted by: stevenmartin99 (---.b-ras1.srl.dublin.eircom.net)
Date: January 28, 2012 05:37PM

using ISSET and EMPTY


Your line fails becauses if the value is not in the url.. it cant set it..


if(isset($_GET['fieldname']) && !empty($_GET['fieldname']) ) $fieldname = $_GET['fieldname'];

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]



Edited 5 time(s). Last edit at 01/29/2012 12:44PM by stevenmartin99.

Options: ReplyQuote
Re: Wampserver (PHP Version 5.3.8) gives error messages where in host (PHP Version 5.2.12) everything is all right
Posted by: goalsurfer (---.47-64-87.adsl-dyn.isp.belgacom.be)
Date: January 29, 2012 11:41AM

It appears to work. I first put for the url without '?'): $fieldname = value; or $fieldname = 'string';

and then:

if(isset($_GET['fieldname']) && !empty($_GET['fieldname']) ) $fieldname = $_GET['fieldname'];

Thanks a lot.

Options: ReplyQuote
Re: Wampserver (PHP Version 5.3.8) gives error messages where in host (PHP Version 5.2.12) everything is all right
Posted by: stevenmartin99 (---.b-ras1.srl.dublin.eircom.net)
Date: January 29, 2012 12:46PM

yes but you should buid it into a function that you store in a config file that is loaded for every file

name the function something like

$fieldname = GetPostData['fieldname'];

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Wampserver (PHP Version 5.3.8) gives error messages where in host (PHP Version 5.2.12) everything is all right
Posted by: jawiseman@yahoo.com (---.washdc.fios.verizon.net)
Date: July 10, 2012 09:01PM

Steven (and others)

I have same issues as above (production server working fine at immersonal.com; but local host using WAMP is giving me massive error reporting.

I have followed your posts on this topic in several places but changing php.ini to error_reporting = E_ALL & ~E_NOTICE and restarting WAMP and checking localhost again did not fix the problem (or otherwise do anything). Examples of reporting I am still getting:

"Strict standards: Non-static method truethemes_accordion_class::init() should not be called statically in C:\wamp\www\imm_dev\wp-content\themes\Karma\truethemes_framework\global\shortcodes.php on line 692
Call Stack
# Time Memory Function Location
1 0.0006 247888 {main}( ) ..\index.php:0
2 0.0011 251464 require( 'C:\wamp\www\imm_dev\wp-blog-header.php' ) ..\index.php:17
3 0.0016 265096 require_once( 'C:\wamp\www\imm_dev\wp-load.php' ) ..\wp-blog-header.php:12
4 0.0021 277136 require_once( 'C:\wamp\www\imm_dev\wp-config.php' ) ..\wp-load.php:29
5 0.0031 366256 require_once( 'C:\wamp\www\imm_dev\wp-settings.php' ) ..\wp-config.php:100
6 0.2342 17490136 include( 'C:\wamp\www\imm_dev\wp-content\themes\Karma\functions.php' ) ..\wp-settings.php:571
7 0.2352 17524328 require_once( 'C:\wamp\www\imm_dev\wp-content\themes\Karma\truethemes_framework\truethemes_framework_init.php' ) ..\functions.php:13
8 0.2501 18349568 require_once( 'C:\wamp\www\imm_dev\wp-content\themes\Karma\truethemes_framework\global\shortcodes.php' ) ..\truethemes_framework_init.php:23

( ! ) Strict standards: Non-static method truethemes_tab_class::init() should not be called statically in C:\wamp\www\imm_dev\wp-content\themes\Karma\truethemes_framework\global\shortcodes.php on line 764
Call Stack
# Time Memory Function Location
1 0.0006 247888 {main}( ) ..\index.php:0
2 0.0011 251464 require( 'C:\wamp\www\imm_dev\wp-blog-header.php' ) ..\index.php:17
3 0.0016 265096 require_once( 'C:\wamp\www\imm_dev\wp-load.php' ) ..\wp-blog-header.php:12
4 0.0021 277136 require_once( 'C:\wamp\www\imm_dev\wp-config.php' ) ..\wp-load.php:29
5 0.0031 366256 require_once( 'C:\wamp\www\imm_dev\wp-settings.php' ) ..\wp-config.php:100
6 0.2342 17490136 include( 'C:\wamp\www\imm_dev\wp-content\themes\Karma\functions.php' ) ..\wp-settings.php:571
7 0.2352 17524328 require_once( 'C:\wamp\www\imm_dev\wp-content\themes\Karma\truethemes_framework\truethemes_framework_init.php' ) ..\functions.php:13
8 0.2501 18349568 require_once( 'C:\wamp\www\imm_dev\wp-content\themes\Karma\truethemes_framework\global\shortcodes.php' ) ..\truethemes_framework_init.php:23"

Any help is appreciated!

Options: ReplyQuote
Re: Wampserver (PHP Version 5.3.8) gives error messages where in host (PHP Version 5.2.12) everything is all right
Posted by: RiggsFolly (---.as13285.net)
Date: July 11, 2012 01:40PM

In your php.ini does the error_reporting parameter contain E_STRICT

If it does remove it.

Options: ReplyQuote
Re: Wampserver (PHP Version 5.3.8) gives error messages where in host (PHP Version 5.2.12) everything is all right
Posted by: jawiseman@yahoo.com (---.washdc.fios.verizon.net)
Date: July 11, 2012 02:51PM

I had since played with error reporting in php.ini and tried this. It did not change anything. Current setting= E_ALL & ~E_NOTICE & ~E_STRICT.

I have tried many combinations, including E_ALL & ~E_STRICT, and none changed anything for some reason; e.g. still get the error messages.

I had thought this would work but to no avail.

Options: ReplyQuote
Re: Wampserver (PHP Version 5.3.8) gives error messages where in host (PHP Version 5.2.12) everything is all right
Posted by: RiggsFolly (---.as13285.net)
Date: July 12, 2012 02:45PM

From the PHP Manual
Note:

In PHP 5 a new error level E_STRICT is available. As E_STRICT is not included within E_ALL you have to explicitly enable this kind of error level.

So try changing to
error_reporting = E_ALL & ~E_NOTICE

You do not need to negate E_STRICT it would need adding if you wanted to use it.

Options: ReplyQuote


Sorry, only registered users may post in this forum.