Yeah...see...I'm confused apparently! My while loop is getting all of the names correctly, apparently my problem is...once i get them, how do I echo each one out seperately? Based off of the print_r($cs_row) I can see all of the names. What should I be doing differently to output each name into my table? On 11/16/07, Daniel Brown <parasane@xxxxxxxxx> wrote: > > On Nov 16, 2007 1:57 PM, Dan Shirah <mrsquash2@xxxxxxxxx> wrote: > [snip!] > > if($cs_num > 0) { > > while ($cs_row = mssql_fetch_array($cs_type)) { > > $cs_type2 = $cs_row['request_type']; > > $cs_first = $cs_row['first_name']; > > $cs_last = $cs_row['last_name']; > > $cs_name = $cs_first." ".$cs_last; > > print_r ($cs_row); > > } > > } > > This is defining $cs_type2, et al, as $cs_row['request_type'], et > al.... then overwriting them. Is this your desired effect? If so, > why? > > > > $get_tr = "SELECT DISTINCT > > request_type, card_id, first_name, last_name > > FROM > > payment_request > > WHERE > > card_id = '$id'"; > > $tr_type = mssql_query($get_tr) or die(mssql_get_last_message()); > > $tr_num = mssql_num_rows($tr_type); > > > > if($tr_num > 0) { > > while ($tr_row = mssql_fetch_array($tr_type)) { > > $tr_type2 = $tr_row['request_type']; > > $tr_first = $tr_row['first_name']; > > $tr_last = $tr_row['last_name']; > > $tr_name = $tr_first." ".$tr_last; > > print_r ($tr_row); > > } > > } > > Same basic idea here, Danny Boy. What are you doing the > transliteration for when you're not accessing those variables (at > least as far as I can see)? > > > $num_total = $cs_num + $tr_num; > > $multiple = "MULTIPLE"; > > ?> > > > > Here is where I am running into problems. First I am writing an if () > > statement to see if there were any rows returned from the queries. If a > row > > was returned I am echoing out the data that was assigned to the > different > > variables above. This works...kind of... > > > > <td width='89' height='13' align='center' class='tblcell'><div > > align='center'><?php echo "<a > href='javascript:editRecord($id)'>$id</a>"; > > ?></div></td> > > <td width='172' height='13' align='center' class='tblcell'><div > > align='center'><?php if ($cs_num > 0) { echo "$cs_name<br />\n"; } > > if ($tr_num > 0) { echo "$tr_name<br />\n"; > > } ?></div></td> > > <td width='201' height='13' align='center' class='tblcell'><div > > align='center'><?php echo "$dateTime"; ?></div></td> > > <td width='158' height='13' align='center' class='tblcell'><div > > align='center'><?php if ($num_total > 1) { echo $multiple; } > > if ($num_total == 1 && $cs_num == 1) { echo > $cs_type2; > > } > > if ($num_total == 1 && $tr_num == 1) { echo > $tr_type2; > > } ?></div></td> > > <td width='160' height='13' align='center' class='tblcell'><div > > align='center'><?php echo "$last_processed_by"; ?></div></td> > > > > If a single row was returned by the query, all of the information echos > out > > just fine. BUT, If one of the queries returned more than one row, the > > information that is echo'd out is only the LAST row's information. For > > example, the result of my $cs_type query returns 3 names: John Smith, > Jane > > Smith, James Smith. The only information being populated to my table is > > James Smith. Because of this I think I need to put a loop where the > echo > > "$cs_name<br />\n"; is so it will loop through all of the returned names > and > > show them all. I have tried a for, foreach and while loop but I just > can't > > seem to wrap my fingers around the right way to use it. > > > > Any help is appreciated. > > > > Thanks, > > Dan > > > > > > -- > Daniel P. Brown > [office] (570-) 587-7080 Ext. 272 > [mobile] (570-) 766-8107 > > If at first you don't succeed, stick to what you know best so that you > can make enough money to pay someone else to do it for you. >