On Jun 24, 2014, at 12:27 AM, Ethan Rosenberg <erosenberg@xxxxxxxxxxxxxxxxxxxx> wrote: > Dear List - > > I know I have a mistake here, but I cannot find it. > > This is a part of a switch. > > The switch is fed with a formatted phone number [123-456-7890], which is then tested for validity, and if valid the results of the query are displayed. I cannot get to the display part. > > Here is the code: ... > > > TIA > > Ethan > Hi Ethan, Try this. I did it on the fly and haven't tested, but I think it will put you on the right path. You most likely will have to put your own juice on $return_string. I tried to follow as best as I could to the type of output your wanting. HTH. [CODE] switch (step) { case 'step28': $return_string = 'Here we are, Step 28'; $Phone = ""; $phn = $_POST['phone']; $dsh = '-'; $i = 0; while($i < strlen($phn)) { if($i === 2 || $i === 6) { $Phone .= $phn[$i].$dsh; } else { $Phone .= $phn[$i]; } $i++; } $sql1 ="SELECT Cust_Num, Lname, Fname FROM Customers WHERE Phone = '".mysqli_real_escape_string($Phone)."' "; $result1 = mysqli_query($cxn, $sql1); $return_string .= 'here2'; if ( 0 === $result1->num_rows ) { $return_string = '<div style="text-align:center;"><strong style="margin-bottom:32px;">No Match Found</strong></div>'; } else { $return_string .= 'here3'; $return_string .= '<br />result..... '.$result1; $result = 0; $return_string .= '<div style="text-align:center;"> <table border="4" cellpadding="5" cellspacing="55" rules="all" frame="box"> <tr class="heading"> <th>Cust. Number</th> <th>Last Name</th> <th>First Name</th> </tr>'; $row1 = mysqli_fetch_row($result1); while($row1) { $return_string .= '<tr> <td>'.htmlspecialchars($row1[0]).'</td> <td>'.htmlspecialchars($row1[1]).'</td> <td>'.htmlspecialchars($row1[2]).'</td> </tr>'; } } $return_string .= '</table></div>'; break; } [END CODE] Best, Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php