How can I re-code?
| From: | John Taylor-Johnston | Date: | Sun, 19 Sep 2004 00:04:41 +0000 |
| Subject: | How can I re-code? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-197149@lists.php.net to get a copy of this message | ||
I had an $array, with a list of authors and an entry number. Below is the code I used. Now I
have compiled it all into a table. I don't know how to re-code these lines:
foreach (array_count_values ($authors) as $author=>$count)
foreach ($author_list[$author] as $ausid)
-----------new code-----------
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query("select ccl_id,AUS from $table ORDER by AUS");
while ($mydata = mysql_fetch_object($news))
{
?? foreach (array_count_values ($authors) as $author=>$count)
{
?? foreach ($author_list[$author] as $ausid)
{
}
}
}
------ My old code ---------
foreach (array_count_values ($authors) as $author=>$count)
{
echo "<tr>";
echo "<th>$author</th>";
echo "<th>".$count." records found/trouvés)</th>";
echo"</tr>\n";
echo "<tr bgcolor=\"#F5F5F5\"><td> </td>";
echo "<td align=\"left\">";
$temp = "";
foreach ($author_list[$author] as $ausid)
{
$temp .= "$ausid, ";
}
$temp = substr("$temp", 0, -2);#delete ", "
echo "$temp</td>";
echo "</tr>\n";
}
--
John Taylor-Johnston
-----------------------------------------------------------------------------
°v° Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures
/(_)\ Université de Sherbrooke
^ ^ http://compcanlit.ca/