Hi,
I’m new at php and need to modify some code to limit the display length of an array.
Because of the amout of data in the database, this code is diplaying everything in the array.
I want to be able to adjust the limit hopefully by number and since have it display … at the end.
Here is the code.
[code]require_once(“common.inc.php”);
require_once(“config.inc.php”);
$sql = “SELECT area FROM $t_area WHERE countryid = $xcountryid”;
$area_res = mysql_query($sql);
if (mysql_num_rows($area_res))
{
?>
echo "<b>$lang[AREAS_IN_SECTION]:</b> ";
while($area_row = mysql_fetch_array($area_res))
{
$array[]= $area_row['areaname'];
}
$j=count($array);
for($i=0;$i<$j;$i++)
{
echo ‘’ . $array[$i] . ‘’;
//echo $array[$i];
if($i< ($j-1))
{
echo '<font color="black">,</font> ';
}
}
}
?>
would what I need be in $j=count($array);
or $area_row
Thanks