foreach not in reach
| From: | jtjohnston | Date: | Fri, 22 Feb 2002 06:48:24 +0000 |
| Subject: | foreach not in reach | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-85820@lists.php.net to get a copy of this message | ||
Question 1:
How can I append strings to my authors array?
Me thinks this doesn't work :§) ?
$authors .= explode(";", $mydata->KW);
I'm getting "Invalid argument supplied for foreach()"
Question 2:
Once I get this working, I want to (a) alphabetise the contents of the
array, (b) count repititions, (c) elimintate copies, and create an array
I can print with tow things "$author[i]\t$counter[i]", so I end up with
something like:
Adam 2
Louis 5
John 3
Mary 8
------------------------------------------------------------------------
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query("select KW from $table");
while ($mydata = mysql_fetch_object($news))
{
$authors .= explode(";", $mydata->KW);
}
foreach ($authors as $author)
{
echo "$author<br>\n";
}
------------------------------------------------------------------------
I'm learning, slowly but surely Martin :)
J