 |
 |
|
Addresses, Phone Numbers
& Personnel
Function add_contactInfo($ctyID)
{
$sql_3 = "SELECT CONCAT(contFname , ', ', contlastname) AS name, cont_id, contemail from contactbl where city_id=$ctyID";
$Result_3= mysql_query($sql_3) or die(mysql_error());
$number_3=mysql_num_rows($Result_3);
if($number_3 > 0)
{
while($rows = mysql_fetch_assoc($Result_3))
{
$contID[]=$rows['cont_id'];
$contName[]=$rows['name'];
$contEmail[]=$rows['contemail'];
//echo "$rows[name] ";
}
}
/////////
$numRec3=sizeof($contID);
echo '';
$numRow3=($numRec3 /2)+1;
$num_col3=2;
$ii3=0;
$recnum3=0;
$arraymax=$numRec3;
for($ic3=0; $ic3< $numRow3; $ic3++)
{
if($ii3 < $numRow3)
{
echo ' ';
for($ir3=0; $ir3<$num_col3; $ir3++)
{
//echo "| $recnum3 | ";
if($recnum3 < $arraymax)
{
echo "";
if ($contEmail[$recnum3] =='')
{
echo "$contName[$recnum3] | ";
}else{
echo " $contName[$recnum3]";
}
$recnum3++;
}
}
$ii3++;
}
echo ' ';
}
//End of table
echo ' ';
////////
}
/*
$sql_1 = "SELECT DISTINCT city_id FROM contactbl";
$result_1 = mysql_query($sql_1) or die(mysql_error());
$number_1=mysql_num_rows($result_1);
if($number_1 > 0)
{
while($row_1 = mysql_fetch_assoc($result_1))
{
*/
$sql_2 = "SELECT city_id, city_name, address, postcode, phone1, phone2 from locationtbl";
$result_2 = mysql_query($sql_2) or die(mysql_error());
$number_2=mysql_num_rows($result_2);
if($number_2 > 0)
{
while($row_2 = mysql_fetch_assoc($result_2))
{
$cityid[]=$row_2['city_id'];
$cityName[]=$row_2['city_name'];
$cityAdd[]=$row_2['address'];
$cityPost[]=$row_2['postcode'];
$Cityphone[]=$row_2['phone1'];
$Cityphone2[]=$row_2['phone2'];
}
}
/*
}
}
*/
$numRec=sizeof($cityid);
echo '';
$numRow=($numRec /2)+1;
$num_col=2;
$ii=0;
$recnum=0;
for($ic=0; $ic< $numRow; $ic++)
{
if($ii < $numRec)
{
echo ' ';
for($ir=0; $ir<$num_col; $ir++)
{
echo "| ";
echo " $cityName[$recnum] ";
if( $Cityphone[$recnum] != '')
{
echo "$Cityphone[$recnum] ";
}
if( $Cityphone2[$recnum] != '')
{
echo "$Cityphone2[$recnum] ";
}
if($cityAdd[$recnum] !='')
echo "$cityAdd[$recnum], ";
if($cityName[$recnum] !='' && $cityAdd[$recnum] !='')
echo "$cityName[$recnum] ";
if($cityPost[$recnum] !='')
echo"$cityPost[$recnum] ";
echo " ";
/////
// add_contactInfo($cityid[$recnum]);
echo " | ";
//////
$ii++;
$recnum++;
}
}
echo ' ';
}
//End of table
echo ' ';
?>
|