PHP Mystery
| From: | Ethan Rosenberg, PhD | Date: | Sun, 22 Jun 2014 05:00:17 +0000 |
| Subject: | PHP Mystery | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-323506@lists.php.net to get a copy of this message | ||
Dear List -
Here is a simple program.
It ran before, but not now...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
</head>
<body>
<div align="center">
<form method="post">
<input type='text' name=phone></input>
<input type='submit'>
<br /><br /><br />
</form></div> <?php error_reporting(-1); require '/home/ethan/PHP/ethan.inc'; $db = "Store"; $cxn = mysqli_connect($host,$user,$password,$db); if (!$cxn) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
//if no connection no error message
$phn = $_POST[phone];
//Phone is a 10 digit numerical string, no spaces
$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];
//construct phone number 123-466-7890
$sql1 ="select Lname, Fname from Customers where Phone = '$Phn' ";
$result1 = mysqli_query($cxn, $sql1);
if(!$result1)
{
?>
<div align="center">
<strong>No Match Found</strong>
<br /><br />
</div>
<?php
}
//if query fails, no error message.
//code to display query results, not listed.
TIA
Ethan