Ok so I didn't see anything like this in the previous postings so if if has been covered before sorry for the repost.
I am trying to put a second do..while statement in the same page but when I do this it seems to drag down the page. it loads fine if I have only one statement in there but the minute I put in a second one it takes forever to load the page. I have a need of adding a total of 9 do..while statements which will most likely kill the page at this point. I'm not sure why it would be doing this any ideas?
The code I'm using is as follows
<p><?php
do {
$row_myContacts = mysql_fetch_assoc($myContacts);
if ($row_myContacts['staffID'] != "81"){
}
else {
echo $row_myContacts['firstName'] . " " . $row_myContacts['lastName'];?></p>
<p class="staff_title_national"><?php echo $row_nmyContacts['titleName'];?></p>
<br />
<li><?php echo $row_myContacts['address1']
. " " . $row_myContacts['address2'] ;?></li>
<li><?php echo $row_myContacts['cityName']
. ", " . $row_myContacts['state_abreviation'] . " "
. $row_myContacts['zipCode'];?></li>
<br />
<li>Office: <?php echo format_phone($new_office_phone); ?></li>
<li>Fax: <?php echo format_phone($new_fax_phone); ?></li>
<br />
<br />
<li>E-Mail:
<a href="<?php echo $row_myContacts['email'];?>"><?php echo $row_myContacts['email'];?></a></li>
<br />
<?php }
} while ($row_myContacts['staffID'] != '81')?>
I have tried testing it so that the staffID is == to the number i need, but it doesn't output anything. I think it should be that way but for some reason it doesn't work. and yes I moved the stuff in that variation so that the else was empty and the if had the information in it.
The page holds 4 sections of contacts under section 1 there is one section with 2 names (same address info) section 2 has 3 names different info, sections 3 and 4 have 2 each with different info. I even created 2 new tables in my database that reference the 4 sections if that helps. I do know my sql statement is correct it pulls all 9 contacts with their corresponding information.
/edit below/
so I also tried the code this way. and I do get it to load the first one but when I add a section for loop it shows nothing. I think it is because I am telling the loop to access the database at the same point that it left off so it isn't starting over on the loop.
<?php
for ($x=$totalRows_myContacts; $x>=1; $x--){
if ($row_myContacts['staffID'] == '81') {
echo $row_myContacts['firstName'] . " " . $row_myContacts['lastName'];?></p>
<p class="staff_title"><?php echo $row_myContacts['titleName'];?></p>
<br />
<li><?php echo $row_myContacts['address1'] . " " . $row_myContacts['address2'] ;?></li>
<li><?php echo $row_myContacts['cityName'] . ", " . $row_myContacts['state_abreviation'] . " " . $row_myContacts['zipCode'];?></li>
<br />
<li>Office: <?php echo format_phone($new_office_phone); ?></li>
<li>Fax: <?php echo format_phone($new_fax_phone); ?></li>
<br />
<br />
<li class="emailTealGrey">E-Mail: <a href="<?php echo $row_myContacts['email'];?>"><?php echo $row_myContacts['email'];?></a></li>
<br />
<?php }$row_myContacts = mysql_fetch_assoc($Contacts);
}?>
so not sure how to tell the database to access itself again and start the query from the top I guess is what I need to do. any ideas how to tell it to do that?