OK. I use:
while ($mydata = mysql_fetch_object($news))
{
$authors = explode(";", $mydata->AS);
}
Then why "Invalid argument supplied for foreach()"
Am I indeed building an array as I go through my database?
foreach($authors as $author)
{
#echo sort($author)".<br>\n";
echo "$author<br>\n";
}
http://www.php.net/manual/en/control-structures.foreach.php
foreach ($arr as $value) {
echo "Value: $value<br>\n";
}
I have the right syntax? Did I build the array?
Newbie, but have to learn it somehow :)
----------------snip---------------------
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query("select AS from $table");
while ($mydata = mysql_fetch_object($news))
{
$authors = explode(";", $mydata->AS);
}
foreach($authors as $author)
{
echo "$author<br>\n";
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php