m geting an unexpected error in my code plz tel me where am i wrng my code because i have wriiten mysql_num_rows many time

<?php
session_start();
print_r($_POST);

$con=mysql_connect("localhost","root","");
 
	mysql_select_db("pras2",$con);
	
	$slip_no=$_POST['slip_id'];
	
	$query="SELECT * FROM `slip` WHERE slip_id='$slip_no'";
	$result=mysql_query($query);
	if ($result)
	{
	$query1= "UPDATE `slip` SET status='accepted' WHERE slip_id='$slip_no'";
	$result1= mysql_query($query1);
	
	    if($result1)
	    {
		if (mysql_num_rows($result1)==1)
		{
		
		$row=mysql_fetch_row($result1);
		$shift_id=$row['shift_id'];
		$product_name=$row['product_name'];
		$quantity=$row['quantity'];
		
		$query2= "INSERT INTO transfer_slip(shift_id, product_name, item1, num1, department_from, department_to) VALUES ( '$shift_id', '$product_name', 'handles', '$quantity', 'intermediate', 'tufting'";
		$result2=mysql_query($query2) or die (mysql_error());
		if ($result2)
		{
		echo " transfer slip generated";
		}
		else
		{
		echo "transfer slip failed";
		}
		}
		}
		else
		{
		echo "order not accepted";
		}
		}
		else
		{
		echo "no slip found of this name";
		}
		
		
		?>

the error is

( ! ) Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\pras\acceptance_slip.php on line 20

UPDATE statements don't return resource, they return boolean values so the value of $result1 on line 16 will always be boolean. You are getting that error message because the mysql_num_rows function expects a resource, not a boolean.

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.