Problem with query

"Ethan Rosenberg, PhD" <[email protected]>
Newsgroups gmane.comp.php.database
Organization Hygeia Biomedical Research, Inc.
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.