Re: How can I re-code?

From: Date: Mon, 20 Sep 2004 01:00:35 +0000
Subject: Re: How can I re-code?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-197228@lists.php.net to get a copy of this message
No one? > 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>&nbsp;</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/

« previous php.general (#197228) next »