Jump to content

Getting error: "Warning: Invalid argument supplied for foreach()...."


adwaitk007

Recommended Posts

Hello,

I am newbie to this forum and also not a professional coder. Only have little bit of knowledge but not an expert. So I am in need of your help.

 

I am having a mp3 search engine script installed here:

www.listenmymp3.com

 

The problem:

whenever anyone tries to register the system shows "Registration failed" error! If he refresh the page then automatically registration form comeup! then if anyone fills the form and press "join now" it gives some forehech() error!

 

Detailed error:

 

it says:

Warning: Invalid argument supplied for foreach() in /.............../register.php on line 187
Warning: Invalid argument supplied for foreach() in /.............../register.php on line 229

 

From line 183 to 194 the code is:

<?
if($form->num_errors > 0){
  // echo " <font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font> ";
  $i=0;
  foreach($form->errors as $cur){
  if($cur==""){}else{$i++;
  echo"";}
  }  
}

   unset($HTTP_SESSION_VARS['regsuccess']);
?>

 

And from line 225 to 234 the code is:

<?
if($form->num_errors > 0){
  
  $i=0;
  foreach($form->errors as $cur){
  if($cur==""){}else{$i++;
  echo"<font size=\"2\" color=\"#ff0000\">".$cur."</font><br> ";}
  } echo "<br> <font size=\"2\" color=\"#ff0000\">".$i." error(s) found</font></center> ";
  //print_r($form->errors[$field]);
}
?>

 

So can anyone tell me what's wrong with it?? Any solution to this problem??

Link to comment
Share on other sites

That is a warning, which is not an error.  If this is a production server you should not be displaying errors but rather logging them to a file.

 

Bottom line, that script is really old and employs poor coding techniques and antiquated PHP.  I would suggest finding a better one.

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.