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

Recommended Answers

All 3 Replies

Member Avatar for diafol

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

hi ardav,

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

Member Avatar for diafol

OK, mark this thread solved.

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.