Jump to content

so much trouble with this php5 - can anybody help me please?


arn_php

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.