Problem with query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear List -

There is an error in my query, and I cannot find it.

This fails:

$_SESSION['Cust_Num'] = $_REQUEST['cnum'];
$_SESSION['CustNum'] = $_REQUEST['cnum'];

echo "session<br />"; //this has the proper values
print_r($_SESSION);

$sql10 = "select Balance, Payments, Charges, Date from Charges where
Cust_Num = $_SESSION[Cust_Num] order by Date";
echo $sql10; //echos the correct query
$result10 = mysqli_query($cxn, $sql10);
var_dump($result1); // this returns NULL
echo "<center><strong>Current Results</strong></center>";
echo "<center>";
echo "<table border='4' cellpadding='5' cellspacing='55' rules='all'
frame='box'>";
echo "<tr class='heading'>";
echo "<th>Balance</th>";
echo "<th>Payments</th>";
echo "<th>Charges</th>";
echo "<th>Date</th>";
echo "</tr>";
echo "row1<br />";
print_r($row10);
do
{
?>
<tr>
<td> <?php echo $row10[0]; ?> </td>
<td> <?php echo $row10[1]; ?> </td>
<td> <?php echo $row10[2]; ?> </td>
<td> <?php echo $row10[3]; ?> </td>
</tr>
<?php
} while (($row10 = mysqli_fetch_row($result10))!= 0 );
?>
</table>
<br /><br /><br /><br />
</center>

This works:

$sql1 = "select Balance, Payments, Charges, Date from Charges where
Cust_Num = $_POST[cnum] order by Date";
$result1 = mysqli_query($cxn, $sql1);
echo "<br /><br />";
<?php
echo "<center><strong>Current Results</strong></center>";
echo "<center>";
echo "<table border='4' cellpadding='5' cellspacing='55' rules='all'
frame='box'>";
echo "<tr class='heading'>";
echo "<th>Balance</th>";
echo "<th>Payments</th>";
echo "<th>Charges</th>";
echo "<th>Date</th>";
echo "</tr>";
// echo "</span>";
$row1 = mysqli_fetch_row($result1);
print_r($row1);
do
{
?>
<tr>
<td> <?php echo $row1[0]; ?> </td>
<td> <?php echo $row1[1]; ?> </td>
<td> <?php echo $row1[2]; ?> </td>
<td> <?php echo $row1[3]; ?> </td>
</tr>
<?php
} while (($row1 = mysqli_fetch_row($result1))!= 0 );
?>
</table>
<br /><br /><br /><br />
</center>

TIA

Ethan


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux