Hello everyone....

I'm back working on the website again... I'm having lots of fun.
I have a sql query that looks at one field in a database. (result2 query)
Then i have mysql_fetch_array statement.

I then use this array to print links on the page.
Works fine except I don't want duplicate links.

It creates links for the states.  If we have four customers from Pennsylvania.  
This current process gives me four different "PA" links on my page.  

I need a statement that says...if its already printed...don't print it...


Here is my code:




$db = mysql_connect("HOST", "USERNAME", "PASSWORD");


if ($_GET[area]=="") {

$master = mysql_query("SELECT * FROM egw_addressbook

WHERE cat_id='8' ORDER BY org_name", $db);

} else {

$master = mysql_query("SELECT * FROM egw_addressbook

WHERE cat_id='8' and adr_one_region='$_GET[area]' ORDER BY org_name", $db);


$result2 = mysql_query("SELECT adr_one_region FROM egw_addressbook

WHERE cat_id='8' ORDER BY adr_one_region", $db);

if ($area = mysql_fetch_array($result2)) {

echo "Sort by State: ";

do {

echo "<a 

echo " - ";

} while ($area = mysql_fetch_array($result2));

echo "<a href='index.php?area='>ALL</a>\n";

} else {

echo "ERROR";


if ($myrow = mysql_fetch_array($master)) {

echo "<CENTER>\n";

echo "<table border=0>\n";

echo "<img src=file.jpg width='611' height='136'>\n";

echo "<BR>\n";

echo "<BR>\n";

do {

printf("<tr> <td></td><td><b>%s</b></td><td></td><td></td><td>%s</td></tr>\n", 
$myrow["org_name"], $myrow["fn"]); 

printf("<tr> <td></td><td>%s</td><td></td><td></td><td>%s</td></tr>\n", 
$myrow["adr_one_street"], $myrow["tel_work"]);

printf("<tr> <td></td><td>%s, %s 
$myrow["adr_one_locality"], $myrow["adr_one_region"], 

} while ($myrow = mysql_fetch_array($master));

echo "</table>\n";

echo "</CENTER>\n";

} else {

echo "Sorry, no records were found!"; 





Reply via email to