
July 12th, 2002, 09:09 AM
|
|
Junior Member
|
|
Join Date: Jul 2002
Posts: 11
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
What my code does
MY code searches the database and extracts information from each of the users in a given location (locationID= 1 or 2 or 3). Then it puts the info into an array. Using the arrays (one for the users info and another for his neighbors info) it matches the info. Whatever info is matched, it prints out and whatever info is not matched is not printed out, but their record still appears. MY coding format is ugly, but ill post it anyway
PHP Code:
<?
$myrow = mysql_fetch_row($result);
$vcountry = $myrow[29];
$rescou = mysql_query("SELECT * FROM neighbors_1 WHERE Country_Visited !='' AND E_mail != '$email' AND First_Name !='' AND E_mail !=''");
if ($myrow = mysql_fetch_row($rescou)){
echo "<hr>
<center><a name='country'></a></center>SIMILAR COUNTRIES VISITED<centeR>
<table border= 0 cellspacing = 0 width = 97%>\n";
echo "<tr><td height='21' width='150' valign='top' bgcolor='#0000CC'><b><font size='2' color='white'>Name</font></b></td>
<td width='200' valign='top' bgcolor='#0000CC'><b><font size='2' color='white'>Email Address</font></b></td>
<td width='180' valign='top' bgcolor='#0000CC'><b><font size='2' color='white'>Countries Visited</font></b></td>
<td valign='top' width='120' bgcolor='#0000CC'><b><font size='2' color='white'>Phone Number</font></b></td></tr>\n";
do{
if(($myrow[43] == $where)){
$x++;
if (($x % 2) == 1){
$bg='#A8BDF4';
}
else{
$bg='#FFFFFF';
}
print("<tr><td bgcolor='$bg'><font size='2'> ");
printf("<a href=\"personal.php?Customer_ID=%s\"> %s %s</a></font>", $myrow[0],$myrow[1],$myrow[2]);
print("</td><td bgcolor='$bg'><font size='2'>");
printf("<a href=\"mailto:%s\">%s", $myrow[3],$myrow[3]);
print("</a></font></td>");
printf("<td bgcolor='$bg'><font size='2'>");
$a = mysql_query("SELECT Country_Visited FROM neighbors_1 WHERE E_mail = '$email'");
while($b = mysql_fetch_array($a)){
$c = explode(",", $b[0]);
$d = mysql_query("select Country_Visited from neighbors_1 WHERE E_mail='$myrow[3]'");
while($e = mysql_fetch_array($d)){
$f = explode(",", $e[0]);
foreach ($f as $value){
if (in_array($value, $c)){
echo "$value <br>";
}
}
}
}
print("</font></td>");
print("<td bgcolor='$bg'><font size='2'> ");
printf("%s",$myrow[10]);
print("</font></td>");
} else {echo "";}
} while ($myrow = mysql_fetch_row($rescou));
} else { echo "";
}
echo "</table></center><p align='right'><a href='#top'>Back to Top</a></p>\n";
?>
|