Result sorting not working

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

 



I have a search page that displays all active records in my application, but
for some reason, I can not get it to display based on a specific input.

For instance, I have records with id's 2, 3, 4, 5 etc...  In my search form,
the default view shows all records, and my form variable lets you put in
different search criteria.  If I do a search by id and put in "2" as the
search condition, my results keep coming back blank.  It does not matter
which parameter or value I put in, it still returns blank.

Any ideas?

<?php
$connection = mssql_connect($host, $user, $pass) or die ('server connection
failed');
 $database = mssql_select_db("$database", $connection) or die ('DB
selection failed');


 // Query the table and load all of the records into an array.
 $query = "SELECT
    child_support_payment_request.credit_card_id,
  credit_card_payment_request.credit_card_id,
  credit_card_payment_request.date_request_received
   FROM child_support_payment_request,
        credit_card_payment_request
     WHERE child_support_payment_request.credit_card_id =
credit_card_payment_request.credit_card_id";
if ($request_id !== '') {
   $query.=" AND credit_card_payment_request.credit_card_id =
$request_id2";
   }
if ($dateTime !== '') {
  $query.=" AND credit_card_payment_request.date_request_received =
$dateTime2";
  }
$res = mssql_query($query) or die(mssql_error());


 echo "<table width='780' border='1' align='center' cellpadding='2'
cellspacing='2' bordercolor='#000000'>";

while ($rows = mssql_fetch_array($res)) {
  $res_id = $rows['credit_card_id'];
  $res_dateTime = $rows['date_request_received'];
echo "<tr>";
echo "<td width='88' height='13' align='center' class='tblcell'><div
align='center'>$res_id</div></td>";
echo "<td width='224' height='13' align='center' class='tblcell'><div
align='center'>$res_dateTime</div></td>";
echo "<td width='156' height='13' align='center' class='tblcell'><div
align='center'>Open</div></td>";
echo "<td width='156' height='13' align='center' class='tblcell'><div
align='center'>Payment Type</div></td>";
echo "<td width='156' height='13' align='center' class='tblcell'><div
align='center'>Last Processed By</div></td>";
echo "</tr>";
}
echo "</table>";
?>


The variables $request_id and $dateTime are specified in a seperate chunk of
php code, but are still included on the same page as the code below.  Am I
right in assuming that any variable set on the same page can be carried into
different php blocks on the same page?

Example:

<?php

$id = $_POST['request_id']

?>

<?php

echo "<table>";
echo "<td>"'
echo $id;
echo "</td>";
echo "</table>";

?>

That would be valid, correct?

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux