Do not use on any
shared computer
September 6, 2008 03:27pm pdt
 
[x]
Attachment Details

$count variable not listing all search results

I'm using this code in my list of doctors and it works great. however, when i try to use it to output search results it doesn't include all the records in the resulting query. it looks like the record will only print if it's the it's got the lowest primary key - for instance in my table that i'm tying the doctors and the specialties together i've got 3 columns:

doc_id  spec_id  docspec_id
2           3             4
2           4             5
2           5             6

so, the only time doc_id 2 will show up in search results is with spec_id 3 BECAUSE its got the lowest primary key (docspec_id=4)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
<?
$count = 0;
while($row = mysql_fetch_assoc($rsDoctorsAlpha))
{
 if( (($count++) % 2) == 0)
  imgDesc($row);
 else
  descImg($row);
}
function imgDesc($row_rsDoctorsAlpha) {
    echo "<tr>
          <td class=\"p\"><a href=\"detail_alpha.php?id=".$row_rsDoctorsAlpha['main_id']."\"><img src=\"../images/doctors2/".$row_rsDoctorsAlpha['drPhoto'].".gif\" border=\"0\"></a></td>
          <td colspan=\"2\" class=\"p\"><strong><a href=\"detail_alpha.php?id=".$row_rsDoctorsAlpha['main_id']."\">".$row_rsDoctorsAlpha['firstname']."&nbsp;".(($row_rsDoctorsAlpha['mi']=="")? "":$row_rsDoctorsAlpha['mi'].".&nbsp;").$row_rsDoctorsAlpha['lastname'].",&nbsp;".$row_rsDoctorsAlpha['title']."</a></strong>&nbsp;".$row_rsDoctorsAlpha['bioBlurb']."</td>
        </tr>";
    return;
}
 
function descImg($row_rsDoctorsAlpha) {
    echo "<tr>
          <td width=\"12%\" class=\"p\">&nbsp;</td>
          <td width=\"12%\" class=\"p\"><a href=\"detail_alpha.php?id=".$row_rsDoctorsAlpha['main_id']."\"><img src=\"../images/doctors2/".$row_rsDoctorsAlpha['drPhoto'].".gif\" border=0 /></a></td>
          <td width=\"76%\" class=\"p\"><strong><a href=\"detail_alpha.php?id=".$row_rsDoctorsAlpha['main_id']."\">".$row_rsDoctorsAlpha['firstname']."&nbsp;".(($row_rsDoctorsAlpha['mi']=="")? "":$row_rsDoctorsAlpha['mi'].".&nbsp;").$row_rsDoctorsAlpha['lastname'].",&nbsp;".$row_rsDoctorsAlpha['title']."</a></strong>&nbsp;".$row_rsDoctorsAlpha['bioBlurb']." </td>
        </tr>";
    return;
}
 
?>
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: phillystyle123
Question Asked On: 05.16.2008
Participating Experts: 1
Points: 500
Views: 0
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by hielo

Rank: Genius

Expert Comment by hielo:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by phillystyle123
Author Comment by phillystyle123:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by hielo

Rank: Genius

Expert Comment by hielo:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by phillystyle123
Author Comment by phillystyle123:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by hielo

Rank: Genius

Expert Comment by hielo:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by phillystyle123
Author Comment by phillystyle123:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by hielo

Rank: Genius

Expert Comment by hielo:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by phillystyle123
Author Comment by phillystyle123:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by hielo

Rank: Genius

Expert Comment by hielo:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by phillystyle123
Author Comment by phillystyle123:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628