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 Quote 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. Quote 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" Quote 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. Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/65307-solved-foreach-problem/#findComment-326159 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.