General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Iron Speed
 
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:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #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!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway