PHP Returning Blank Page?

Hi,

So I have a php page that calculates when a product will run out of stock based on date and scheduled qty changes. For some reason, when I change the Query slightly, it gives me a blank page with no explanation.
Here’s the code:
[php]

<?php require 'inc/conn.php'; if (isset($_GET['date'])&&isset($_GET['part'])) { $date = trim($_GET['date']); $part = trim($_GET['part']); /*if (!$part = "") { $part = trim($_GET['part']); } else $part = "%%";*/ $dquery = "SELECT * FROM SC110100 WHERE SC11002 BETWEEN '1900-01-01' AND '".$date."' AND SC11001 LIKE '%".$part."%' AND SC11005<=0 ORDER BY SC11002 ASC"; $dqr = odbc_exec($conn, $dquery); $squery = "SELECT SC03001, SC03003 FROM SC030100 WHERE SC03001 LIKE '".$part."'"; $sqr = odbc_exec($conn, $squery); // IF TRANSACTIONS EXSIST IN TIMEFRAME, CONTINUE if (odbc_num_rows($dqr)>=1) { while ($s_row = odbc_fetch_array($sqr)) { $bal = $s_row['SC03003']; echo round($s_row['SC03003'])." ".$s_row['SC03001']."

"; while ($d_row = odbc_fetch_array($dqr)) { // DATE CALCULATIONS $bal = $bal+$d_row['SC11005']; // GET RID OF TIMESTAMP $d_row['SC11002'] = str_replace('00:00:00.000', '', $d_row['SC11002']); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if ($bal>0) { echo ""; } else echo ""; } echo "
".$d_row['SC11002']."".$d_row['SC11003']."".$d_row['SC11007']."".$d_row['SC11001']."".round($d_row['SC11005'])."".$bal."
".$bal."
"; } } else echo 'No Results Found.'; } else include 'inc/searchform.php'; ?>

[/php]

In the search form, the two fields are date and product number. When I leave product number blank, it gives me a blank page. Can someone help. Please?

Hello

generally these type of problem occurs when we pass variable in query and that variable have no value

please try to print query and run it directly in phpmyadmin

then see its giving result or not

if it gives result then go to the loop and try to trace with exit statement

http://www.senthiexpress.com/

Thanks

I’m not sure… try this

[php]<?php
include ‘inc/conn.php’;

if ((isset($_GET[‘date’]))&&(isset($_GET[‘part’]))) {
$date = trim($_GET[‘date’]);
$part = trim($_GET[‘part’]);
/if (!$part = “”) {
$part = trim($_GET[‘part’]);
} else $part = “%%”;
/

$dquery = "SELECT * FROM SC110100
		WHERE SC11002 BETWEEN '1900-01-01' AND '".$date."'
		AND SC11001 LIKE '%".$part."%'
		AND SC11005<=0
		ORDER BY SC11002 ASC";

$dqr = odbc_exec($conn, $dquery);

$squery = "SELECT SC03001, SC03003 FROM SC030100
		WHERE SC03001 LIKE '".$part."'";
$sqr = odbc_exec($conn, $squery);

// IF TRANSACTIONS EXSIST IN TIMEFRAME, CONTINUE
if (odbc_num_rows($dqr)>=1) {

	while ($s_row = odbc_fetch_array($sqr)) {
		$bal = $s_row['SC03003'];
		echo round($s_row['SC03003'])." ".$s_row['SC03001']."<br /><br /><table border='1px'>";
			while ($d_row = odbc_fetch_array($dqr)) {
				// DATE CALCULATIONS
				$bal = $bal+$d_row['SC11005'];
				// GET RID OF TIMESTAMP
				$d_row['SC11002'] = str_replace('00:00:00.000', '', $d_row['SC11002']);
				
				echo "<tr>";
					echo "<td><b>".$d_row['SC11002']."</b></td>";
					echo "<td>".$d_row['SC11003']."</td>";
					echo "<td>".$d_row['SC11007']."</td>";
					echo "<td>".$d_row['SC11001']."</td>";
					echo "<td>".round($d_row['SC11005'])."</td>";
						if ($bal>0) {
							echo "<td>".$bal."</td></tr>";
						} else echo "<td style='color:red;'>".$bal."</td></tr>";
					
				}
		echo "</table>";
	}
} 
else
echo 'No Results Found.';

}
else
include ‘inc/searchform.php’;
?>[/php]

The best way to find in which line problem is use

echo “test”;
exit;

put this after the line which you think is creating problem and see in the browser is your test printed where you don’t get the test means the line above echo “test”; is the problem. This is the good habit to check your work at least you will get the exact source of problem

Hope this will help you

Sponsor our Newsletter | Privacy Policy | Terms of Service