0

Can anyone tell me why I keep getting a plain white screen after submitting my form? Here's the code (some of them are generated by dreamweaver and I don't think I have enough time to learn how to do it manually because I need this running in a few hours)

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formform")) {
	
//already reserved--------------------------------------------------------
$query=sprintf("SELECT * FROM tblsetting");
$settings = mysql_query($query);
while($row=mysql_fetch_array($settings)){
	$maxdays = $row['MaxBooks'];
	$fmaxbooks = $row['fMaxBooks'];
}
////check currently borrowed books----------------------------------------
$Status="pending";
mysql_connect("localhost", "root","");
mysql_select_db("dblib"); 
$result2=sprintf("SELECT * FROM tblbook_borrow WHERE BorrowerID=%s AND Status=%s",
    GetSQLValueString($_SESSION['MM_Username'], "text"), GetSQLValueString($Status, "text"));
$result1 = mysql_query($result2);
$totalRows_result1 = mysql_num_rows($result1) or die(mysql_error());
while($row= mysql_fetch_array($result1)){
	if ($totalRows_result1 = $maxdays){
		die("You've reached the maximum amount of books per person. <br /> Unable to reserve selected book.");
	}
}
////check current reservations--------------------------------------------
$Status="Pending";
//mysql_connect("localhost", "root","");
//mysql_select_db("dblib"); 
$result2=sprintf("SELECT * FROM tblreservation WHERE rStudentNo=%s AND rStatus=%s",
    GetSQLValueString($_SESSION['MM_Username'], "text"), GetSQLValueString($Status, "text"));
$result1 = mysql_query($result2);
$totalRows_result1 = mysql_num_rows($result1) or die(mysql_error());
	if ($totalRows_result1 = 1){
		die("You've reached the maximum amount of books reserved per person. <br /> Unable to reserve selected book.");
	}
////check remaining copies------------------------------------------------
$Status = "Available";
mysql_connect("localhost", "root","");
mysql_select_db("dblib"); 
$result2=sprintf("SELECT * FROM tblaccession WHERE aAN=%s",
    GetSQLValueString($_POST['txtAN'], "text"));
$result1 = mysql_query($result2);
while($row= mysql_fetch_array($result1)){
	$CallNo = $result1['aCN'];
}

$result2=sprintf("SELECT * FROM tblaccession WHERE aCN=%s AND aStatus=%s",
    GetSQLValueString($CallNo, "text"), GetSQLValueString($Status, "text"));
$result1 = mysql_query($result2);
$totalRows_result1 = mysql_num_rows($result1) or die(mysql_error());
if ($totalRows_result1 <= 1){
	die("There is only one available copy left of this book. Unable to reserve selected book.");
}
////check date------------------------------------------------------------
$dayz = "Sunday";
$date =  $_POST['hiddenField'] ;
$weekday = date('l', strtotime($date));
if($weekday=="Sunday"){
die("You cannot reserve a book on Sunday.");
}
////check holiday---------------------------------------------------------
do{
$searchdate = $row_Recordset3['hMonth'] . "/" . $row_Recordset3['hDay'];
$datenow = date("m/d/Y");
  $pos = strrpos($datenow, $searchdate);
if ($pos === false) { 
}
else {
die("You cannot reserve on a holiday");
}
} while ($row_Recordset3 = mysql_fetch_assoc($Recordset3)); 
//--------------------------------------------------------already reserved
	
	
	
	$dates = date("m/d/y");
$times = "HH:MM";
$status = "Pending";
  $insertSQL = sprintf("INSERT INTO tblreserve (bCN, rStudentNo, rDate, rTime, rStatus) VALUES (%s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['txtAN'], "text"),
                       GetSQLValueString($_POST['txtSN'], "text"),
                       GetSQLValueString($_POST['hiddenField'], "text"),
                       GetSQLValueString($times, "text"),
                       GetSQLValueString($status, "text"));
  $txtANS = $_POST['txtAN'];
  $updatequery="update tblaccession set aStatus='Pending' where aAN='$txtANS'";

mysql_select_db($database_mysqlcon, $mysqlcon);
  $Result1 = mysql_query($insertSQL, $mysqlcon) or die(mysql_error());
  $Result2 = mysql_query($updatequery, $mysqlcon) or die(mysql_error());
  $insertGoTo = "step4.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
3
Contributors
5
Replies
7
Views
5 Years
Discussion Span
Last Post by pritaeas
1

did you read your error.log? does it say something?
try to debug your script step by step

0

did you read your error.log? does it say something?
try to debug your script step by step

Sorry it took a while, I tried to start from scratch but it still goes white.. Here's what the error log says

[Fri Oct 21 21:10:21 2011] [error] [client 127.0.0.1] PHP Notice:  Undefined property: MySqlConnection::$password in F:\\xamppxxxxxxxxxxxx\\htdocs\\_mmServerScripts\\mysql.php on line 101
[Fri Oct 21 21:10:21 2011] [error] [client 127.0.0.1] PHP Notice:  Undefined property: MySqlConnection::$password in F:\\xamppxxxxxxxxxxxx\\htdocs\\_mmServerScripts\\mysql.php on line 101
[Fri Oct 21 21:11:59 2011] [error] [client 127.0.0.1] PHP Notice:  Undefined property: MySqlConnection::$password in F:\\xamppxxxxxxxxxxxx\\htdocs\\_mmServerScripts\\mysql.php on line 101
[Fri Oct 21 21:11:59 2011] [error] [client 127.0.0.1] PHP Notice:  Undefined property: MySqlConnection::$password in F:\\xamppxxxxxxxxxxxx\\htdocs\\_mmServerScripts\\mysql.php on line 101

Does dreamweaver CS4 have breakpoints? D:
I've been going over and over the script and I still can't find out why it goes white :/

1

Make sure error reporting is on. You appear to do a query before the connect, perhaps that causes it.

0

Make sure error reporting is on. You appear to do a query before the connect, perhaps that causes it.

I tried commenting the other ones after starting over and I apparently do have an error in my sql statement. Just wish php told me instead of putting on a white screen XD

1
$query = 'SELECT * FROM table WHERE x'; // error of course
$result = mysql_query($query) or die(mysql_error()); // die on mysql error
if ($result)
{
  $row = mysql_fetch_array($result);
  // process
}
else
{
  echo 'No results'; // will get here only if the die() is missing.
}
mysql_free_result($result);

Turn error reporting on in the INI file, or use the error_reporting() function at the top of your script.

Edited by pritaeas: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.