General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 11th, 2002, 01:35 PM
hereford hereford is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 11 hereford User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to hereford
Rid of non matching items

I have this code:
PHP Code:
<?
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';
}
    
$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)){
    print(
"<tr><td bgcolor='$bg'><font size='2'>&nbsp;");
    
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'>");
            
$f explode(","$e[0]);
            foreach (
$f as $value){
                if (
in_array($value$c)){
                    echo 
"$value &nbsp;<br>";
                    }
                }
    print(
"</font></td>");
    print(
"<td bgcolor='$bg'><font size='2'>&nbsp;");
    
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";

?>


How can i make it so that the people who do not have matching countries (blank lists) do not appear at all

Reply With Quote
  #2  
Old July 12th, 2002, 02:24 AM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
what does your code actually do?

Reply With Quote
  #3  
Old July 12th, 2002, 09:09 AM
hereford hereford is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 11 hereford User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to hereford
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'>&nbsp;");
    
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&nbsp;<br>";

                    }
                }


            }
        }
    print(
"</font></td>");
    print(
"<td bgcolor='$bg'><font size='2'>&nbsp;");
    
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";

?>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Rid of non matching items


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek