Re: [PHP-DB] Re: What is my Mistake?
[email protected] ("Ethan Rosenberg, PhD") Tue, 24 Jun 2014 12:27:24 -0400
| Newsgroups | php.db |
|---|---|
| Organization | Hygeia Biomedical Research, Inc. |
| Message-ID | <[email protected]> |
On 06/24/2014 09:39 AM, Jim Giner wrote:
> Ethan -
> You say your script stops here : echo 'here3'; To be sure, you mean
> that the script DOES echo out 'here3' or does NOT get there? I'm going
> to guess that it does get to that echo statement but the very next one
> is going to kill you because you cannot echo out a resource.
>
> ONCE AGAIN - do you have php error checking turned on as you've been
> told many many times?
>
Jim -
Thanks.
ini_set('display_errors', 'on');
ini_set('display_startup_errors', 'on');
error_reporting(-2);
ini_set('error_reporting', 'E_ALL | E_STRICT');
ini_set('html_errors', 'On');
ini_set('log_errors', 'On');
from the program.
here3 is never echoed.
The same code in a free standing program [attached] works beautifully.
TIA
Ethan
TestPhone.php
(application/x-httpd-php, 2.5 KB)
<!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>
<?php
$bla = 1;
?>
<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);
// $cxn = mysqli_connect("A","B","C","D");
// $cxn = mysqli_connect("localhost", "root", "SdR3908", "Store");
// print_r($cxn);
if (!$cxn)
{
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
//echo $_SERVER["DOCUMENT_ROOT"];
//echo 'Success... ' . mysqli_get_host_info($link) . "\n";
//echo 'connection <br />';
//print_r($cxn);
//print_r($_POST);
$phn = $_POST[phone];
$phn = (string)$phn;
//echo $phn;
//echo "<br />$phn[0]$phn[1]$phn[2]<br />";
$dsh = '-';
$Phn = $phn[0].$phn[1].$phn[2].$dsh.$phn[3].$phn[4].$phn[5].$dsh.$phn[6].$phn[7].$phn[8].$phn[9];
//echo $Phn;
$sql1 ="select Cust_Num, Lname, Fname from Customers where Phone = '$Phn' ";
// echo $sql1;
$result1 = mysqli_query($cxn, $sql1);
//echo '<br />result1....$result1';
//print_r($result1);
//var_dump($result1);
if ( 0 === $result1->num_rows )
{
?>
<div align="center">
<strong>No Match Found</strong>
<br /><br />
</div>
<?php
}
//if(0 === $result1.num_rows ) echo "No data found";
if(!$result1)
{
?>
<div align="center">
<strong>No Match Found</strong>
<br /><br />
</div>
<?php
}
?>
<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>
</body>
</html>