arn_php Posted February 24, 2008 Share Posted February 24, 2008 http://www.phpfreaks.com/forums/index.php/topic,180680.15.html Anyhow, when I am in main.php.. this is the error messages that show up (so much trouble with this php5 - can anybody help me please?): Notice: Undefined index: mainsection in d:\edubenefit.com\extranet\libs\lib_extranet_util_functions.php on line 114 This is the code on line 114 of lib_extranet_util_functions.php: if($row['esid'] == $_GET['mainsection']){ echo '<img src="imgs/icon_arrow_down.gif" /> <a href="main.php?'.generate_url_parameters(array('mainsection'=>$row['esid']), 'new').'" class="menu_on">'.stripslashes($row['name']).'[/url]'; echo ' <div class="submeniu">'; generate_submenus($row['esid']); echo '</div>'; }else{ Another error messages on main.php Notice: Undefined index: op in d:\edubenefit.com\extranet\main.php on line 82 Notice: Undefined index: section in d:\edubenefit.com\extranet\main.php on line 154 switch($_GET['op']){--------------> line 82 if( (($_GET['section'] != '') && ($_GET['section'] != 'mainmenu')) ){--------------> line 154 Quote Link to comment https://forums.phpfreaks.com/topic/92791-so-much-trouble-with-this-php5-can-anybody-help-me-please/ Share on other sites More sharing options...
AndyB Posted February 24, 2008 Share Posted February 24, 2008 None of those are error messages. They are warning notices. You can set the error_reporting level lower, but it's better to correct the things causing the warnings to occur. Quote Link to comment https://forums.phpfreaks.com/topic/92791-so-much-trouble-with-this-php5-can-anybody-help-me-please/#findComment-475418 Share on other sites More sharing options...
arn_php Posted February 25, 2008 Author Share Posted February 25, 2008 What do I need to do to correct it? Quote Link to comment https://forums.phpfreaks.com/topic/92791-so-much-trouble-with-this-php5-can-anybody-help-me-please/#findComment-475434 Share on other sites More sharing options...
AndyB Posted February 25, 2008 Share Posted February 25, 2008 The answer lies in the message - the referenced variables are undefined, i.e. did not pre-exist in the script. Quote Link to comment https://forums.phpfreaks.com/topic/92791-so-much-trouble-with-this-php5-can-anybody-help-me-please/#findComment-475439 Share on other sites More sharing options...
shakeit Posted February 25, 2008 Share Posted February 25, 2008 if you want to hide these notifications you can modify your config file and set the error reporting to a lower value.... Quote Link to comment https://forums.phpfreaks.com/topic/92791-so-much-trouble-with-this-php5-can-anybody-help-me-please/#findComment-475441 Share on other sites More sharing options...
arn_php Posted February 25, 2008 Author Share Posted February 25, 2008 How do I do this? I mean modify my config file and set the error reporting to a lower value.... my config file is only this: // Site title define('SITE_TITLE', 'Edu Benefit'); // contact title define('CONTACT_TITLE', 'Edu Benefit - Website Contact form'); // contact form email define('CONTACT_EMAIL', '******'); define('ADMIN_EMAIL', '******'); // sessions define('SESS_USER', '******'); define('SESS_ADMIN', '******'); //date formatting define('DATE_FORMAT', 'd-m-Y'); define('DATE_FORMAT1', 'd-m-Y H:i'); //PATHS define('PATH_DATA_FILES', 'data_files/'); define('PATH_INCLUDES', 'includes/'); //paths for DYNAMIC EXTRANET define('EXTRANET_DIRECTORY', '../'); define('EXT_DIR_PARAMETERS', 'parameters/'); mod-edit: sensitive info removed Quote Link to comment https://forums.phpfreaks.com/topic/92791-so-much-trouble-with-this-php5-can-anybody-help-me-please/#findComment-475445 Share on other sites More sharing options...
arn_php Posted February 25, 2008 Author Share Posted February 25, 2008 When you mentioned: You can set the error_reporting level lower, but it's better to correct the things causing the warnings to occur. How do I do correct the things causing the warnings to occur. By the way, I am not an expert and most of the answers are really blurry to me. So you need to help me step after step. When you also mentioned: The answer lies in the message - the referenced variables are undefined, i.e. did not pre-exist in the script. If it is not pre-existed, what shall I do - how do I make it exist? Another thing, if this is only a warning notice, how come when I try to update the data within it, it gives me this error: Notice: Use of undefined constant MYSQL_DEBUG - assumed 'MYSQL_DEBUG' in d:\edubenefit.com\extranet\libs\lib_extranet_util_functions.php on line 12. Is this also a warning notice only? Or what I need to do? Quote Link to comment https://forums.phpfreaks.com/topic/92791-so-much-trouble-with-this-php5-can-anybody-help-me-please/#findComment-475456 Share on other sites More sharing options...
PFMaBiSmAd Posted February 25, 2008 Share Posted February 25, 2008 I am guessing that you did not write this script but are stuck with the problems it contains. The notice and warnings that are being generated are a symptom of bad (lazy actually) coding. By themselves, they are not a fatal problem (the error reporting level can be changed to prevent them from being output to the browser) but they indicate that other areas in the code are probably lacking, such as verifying and escaping input data to prevent sql code injection... Each notice/warning message is just the final step of php's error handling code. For each occurrence, php attempted to find a constant or variable name and figure out what the program was doing, so, even if the notices and warnings are prevented from being output, the code is running as slow as possible because all of the extra searching php must do to try and match up constants/variables/index names. Each error must be addressed separately. For the one you just posted about - MYSQL_DEBUG, this is probably an array index name and putting single quotes around it like the error message stated will probably fix it. For the case were a variable might not exist when the code executes, the php isset() function can be used to test if it does exist before making a reference to it. Quote Link to comment https://forums.phpfreaks.com/topic/92791-so-much-trouble-with-this-php5-can-anybody-help-me-please/#findComment-475471 Share on other sites More sharing options...
arn_php Posted February 25, 2008 Author Share Posted February 25, 2008 As I mentioned earlier, I am really a novice and I did find this cms somewhere and has been working great pn php4. Now I need to moveon php5 then all these troubles comes up. If you call me a lazy one, I think I am as my knowledge is really limited in programming too. Here is the script: // ERROR_DESCRIPTION : function error_report($error_description, $error_level=0){ if(MYSQL_DEBUG ==1 ){ ---------> line 12 ?> for the quote: Another thing, if this is only a warning notice, how come when I try to update the data within it, it gives me this error: Notice: Use of undefined constant MYSQL_DEBUG - assumed 'MYSQL_DEBUG' in d:\edubenefit.com\extranet\libs\lib_extranet_util_functions.php on line 12. Is this also a warning notice only? Or what I need to do? Quote Link to comment https://forums.phpfreaks.com/topic/92791-so-much-trouble-with-this-php5-can-anybody-help-me-please/#findComment-475475 Share on other sites More sharing options...
PFMaBiSmAd Posted February 25, 2008 Share Posted February 25, 2008 For the MYSQL_DEBUG error, it appears that it is supposed to be a constant (making it a quoted string makes no sense.) This would mean that where or how the constant is being defined is not working or is not being included/required. It could also be that the constant was deliberately not defined and let the code suffer when it is not. Find if there is a place in your code with a statement like this - define('MYSQL_DEBUG', 0); or ... define('MYSQL_DEBUG', 1); If you don't find any statements that define MYSQL_DEBUG, then add one to your configuration file where all the other define() statements are located (assuming that the file is included by all the other files.) Sorry to be critical of the code, but developing/writing/debugging code with error reporting suppressed or with notice/warnings turned off results in poorly performing code that is not doing minimal checks in the logic so it will break anytime anything unexpected happens. Quote Link to comment https://forums.phpfreaks.com/topic/92791-so-much-trouble-with-this-php5-can-anybody-help-me-please/#findComment-475507 Share on other sites More sharing options...
arn_php Posted February 25, 2008 Author Share Posted February 25, 2008 Ok, thanks. I did add the define('MYSQL_DEBUG', 1); to my config.php. Then I tried it again to modify the entry and found the error clearer. Here is the sample: "We are very sorry but an error has occured. Here are the error details: LIBRARY : /extranet/main.php ERROR DETAILS :ERROR :: LIB_EXTRANET_FORM - MANAGE_SAVE - QUERY<br>Out of range value adjusted for column 'field_display_order' at row 1<br>Query :: UPDATE edub_infob SET name='My name',phone='123.456.7890',ext='123',fax='123.456.7890',email='name@domain.com',flag_status='1',field_display_order='' WHERE infob_id = '1'; Please contact the website administrator and send this report. " What is this? Out of range Value? I was using php 4.4.8 before and found no such error like this but with php5 I am getting all this trouble. Is my Mysql somehow got changed into php5? Quote Link to comment https://forums.phpfreaks.com/topic/92791-so-much-trouble-with-this-php5-can-anybody-help-me-please/#findComment-475517 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.