invalid args?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

invalid args?

Post by Obadiah »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


im getting the error

[b]Warning: Invalid argument supplied for foreach() on line 36[/b]

for this block of code

Code: Select all

foreach($fields_1 as $field => $value)
{
	if(ereg("pass",$field))
		$type = "password";
	else
		$type = "text";
	echo "	<tr><td style=\"text-align:right;
			font-weight:bold\">$value</td>
		<td><input type='$type' name='$field'
				value='".@$$field."'
				size='{$length_1[$field]}'>
		</td></tr>\n";
}
is it because the file its not picking up the database? any suggestions as to how i would go about correcting the problem?


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$fields_1 isn't an array.
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

Post by Obadiah »

i made it an array inside another class file

Code: Select all

$fields_1 = 	array(  "fusername" => "User Name",
			"fpassword" => "Password"
			);
but this particular file isnt being referenced to in this file instead the last file i create will reference both of there files. I was trying to check for errors before continuing the project....are these errors that i should worry about before continuing, or just continue onto the last file to run it and see what happens then?
Post Reply