Hello. I have a simply php script for my school project that checks books back into a library database. What I was trying to accomplish was when you checked in the book for it to check and see if the book has been requested and notify the librarian that there is someone waiting for the book. I thought it was working fine but if my query of the request table returns an empty set things seem to stall.

<?php
		//ini_set('session.cache_limiter','private');
		session_start();
		@mysql_connect($_SESSION['hostname'],$_SESSION['username'],$_SESSION['password']) or die(mysql_error());
		@mysql_select_db($_SESSION['db']);
		
			
		$libraryID = $_POST['libraryID'];
		$query="update checkout set checkinDate = CURDATE() where libraryID = '$libraryID'";
		$result=mysql_query($query) or die(mysql_error());
	
		$query = "SELECT status FROM holdsrequests WHERE libraryID = '$libraryID'";
		$result = mysql_query($query) or die(mysql_error());
		$number = mysql_numrows($result) or die(mysql_error());
		
		if($number > 0){
			$row = mysql_fetch_array($result) or die(mysql_error());
			
			$status = $row['status'];
			if($status == "request"){
				$_SESSION['held'] = $row['cardNumber'];
				
				header('Location:http://localhost/Library/php/checkIn.php?q=request');
				
			}
		}
		else{
			header('Location:http://localhost/Library/php/checkIn.php?q=checkedin');
			
		}*/
	?>

If I take out the $number variable and all reference to it the code works fine. But with it there it simply stops working. I don't get any errors just a blank page. I added in some print statements to see where it was failing and it seems that anything after the $number variable is not getting executed.

and nevermind, the or die statement I had after the $number was messing things up. All fixed now/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.