What is my Mistake?
| From: | Ethan Rosenberg | Date: | Tue, 24 Jun 2014 05:27:48 +0000 |
| Subject: | What is my Mistake? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-48880@lists.php.net to get a copy of this message | ||
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:
case 'step28':
{
echo "here we are, step 28";
$phn = $_POST['phone'];
$phn = (string)$phn;
$dsh = '-';
$Phn = $phn[0].$phn[1].$phn[2].$dsh.$phn[3].$phn[4].$phn[5].$dsh.$phn[6].$phn[7].$phn[8].$phn[9];
$sql1 ="select Cust_Num, Lname, Fname from Customers where Phone = '$Phn' ";
echo $sql1;
$result1 = mysqli_query($cxn, $sql1);
echo 'here2';
if ( 0 === $result1->num_rows )
{
?>
<div align="center">
<strong>No Match Found</strong>
<br /><br />
</div>
<?php
}
echo 'here3'; //stops at this point .................
echo "<br />result..... $result1";
print_r($result1);
$result = 0;
?>
<div align="center">
<table border="4" cellpadding="5" cellspacing="55" rules="all" frame="box">
<tr class='heading'>
<th>Last Name</th>
<th>First Name</th>
<?php
while($row1 = mysqli_fetch_row($result1))
{
$Cust_Num = $row1[0];
$Lname = $row1[1]; $Fname = $row1[2];?> <tr> <td> <?php echo $Cust_Num; ?> </td> <td> <?php echo $Lname; ?> </td> <td> <?php echo $Fname; ?> </td> </tr> <?php } ?>
</table></div> <?php break; } TIA Ethan