SJames Posted August 16, 2007 Share Posted August 16, 2007 I wrote this: foreach ($titles as $value) { print $value; } I get the result: Warning: Invalid argument supplied for foreach() in /home/.... on line 7 *The url has been replace with "...." to save space I know $titles is a valid array Link to comment https://forums.phpfreaks.com/topic/65307-solved-foreach-problem/ Share on other sites More sharing options...
akitchin Posted August 16, 2007 Share Posted August 16, 2007 how do you know $titles is a valid array? use var_dump($titles) to check if it's an array and whether or not it's empty. Link to comment https://forums.phpfreaks.com/topic/65307-solved-foreach-problem/#findComment-326134 Share on other sites More sharing options...
SJames Posted August 16, 2007 Author Share Posted August 16, 2007 I recieve: "Array" Link to comment https://forums.phpfreaks.com/topic/65307-solved-foreach-problem/#findComment-326150 Share on other sites More sharing options...
akitchin Posted August 16, 2007 Share Posted August 16, 2007 you should really receive more than that using var_dump() - it should give you both the type and the value. Link to comment https://forums.phpfreaks.com/topic/65307-solved-foreach-problem/#findComment-326152 Share on other sites More sharing options...
SJames Posted August 16, 2007 Author Share Posted August 16, 2007 Never mind, I got it working: The page that puts the values into the array wasn't doing it right. Thanks for helping! Link to comment https://forums.phpfreaks.com/topic/65307-solved-foreach-problem/#findComment-326159 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.