0

Hi, I have this error Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\Program Files\xampp\htdocs\nsubackend\lib\model\classLabType.php on line 9 & same in line 52.

here's my code:

function __construct($id=0){
		$con = new connection();
		$query = "SELECT * FROM tbllabtype WHERE labtypeID='".$id."'";
		$res = mysql_query($query);
		if(mysql_num_rows($res)>0){
			$row = mysql_fetch_array($res);
			$this->setLabTypeID($row['labtypeID']);
			$this->setLabTypeCode($row['labtypeCode']);
			$this->setLabTypeDesc($row['labtypeDesc']);
		}
		
	}
function showAllLabType(){
		$con = new connection();
		$query = "SELECT labtypeID FROM tbllabtype";
		$res = mysql_query($query);
		if(mysql_num_rows($res)>0){
			while($row = mysql_fetch_array($res)){
				$theid[] = $row['labtypeID'];
			}
			return $theid;
		}
		
	}

please, can somebody help me? thank you

2
Contributors
3
Replies
5
Views
6 Years
Discussion Span
Last Post by diafol
1

Have you checked your connection variables? Either your query isn't right (error) or your connection details aren't right.

0

hi ardav,

Yes, I've seen my error thank you. I have fixed my error after I posted it.. Thank you..

This question has already been answered. 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.