Warning: mysql_numrows() expects parameter 1 to be resource, boolean given in C:\\xamp

Boy, this is so challenging to learn but so addictive. What am I doing wrong guys? the line is 17

<?php?>
<HTML><HEAD>
<script type="text/javascript">
var dateNow = new Date();
  var dayNow = dateNow.getDate();
  var showdate = (dateNow.getMonth()+1)+"/"+dateNow.getDate()+"/"+dateNow.getFullYear();
showdate.value = showdate;
</script>
</HEAD><body><br><script type="text/javascript">
document.write(showdate);
</script></body></html>
<?php
include("getinvno.php"); 
mysql_connect(localhost,root,"");
mysql_select_db(oodb) or die( "Unable to select database");
$result=mysql_query($query);
$num=mysql_numrows($result);
$query="SELECT payrec, ordernum, invnum, bname, bstreet, bcity, bstate, bzip, contact, sname, sstreet, scity, sstate, szip, terms, fob, shipdate, shipamt, dateord, datecomp, datepaid, qty, descr, charges, paidamt, tax, amtdue, paidsum FROM oocust WHERE payrec = 'R' AND pd = ' '";
 $result=mysql_query($query);
 if(mysql_num_rows($result))
 {
  while(list($payrec, $ordernum, $invnum, $bname, $bstreet, $bcity, $bstate, $bzip, $contact, $sname, $sstreet, $scity, $sstate, $szip, $terms, $fob, $shipdate, $shipamt, $dateord, $datecomp, $datepaid, $qty, $descr, $charges, $paidamt, $tax, $amtdue, $paidsum)= mysql_fetch_row($result))
  {
echo "Invoice No: $invnum<br />";
echo "Old Orchard Plumbing<br />2210 Hogan Hollow Road<br />Margate, Fl  33063<br /><br />"; 
echo "Bill To: <br />$bname<br />$bstreet<br />$bcity, $bstate, $bzip<br />";
echo "Contact is: $contact<br /><br />"; 
echo "Ship To: <br />$sname<br />$sstreet<br />$scity, $sstate, $szip<br /><br />"; 
echo "Terms: $terms<br />Due Date: $duedate<br />Fob: $fob<br />Ship Date: $shipdate<br />Order No: $ordernum<br /><br />"; 
echo "This bill is for: $qty $descr<br />Charges: $charges<br />tax=: $tax
<br />Shipment Amt: $shipamt<br />Amount Due: $amtdue<br /><br />"; 
}
 }
 else{echo "No listing for invoice No $invnum .<br />Please select another.<br />";}

?>
<form method="post" action="#">We thank you for your business and timely payment
 <br />
 <input type="text" name="invnum"/> <p>
<input type="submit" name="submit" value="+"/>
</form>

“Boolean given” usually means the SQL server didnt like your query and threw an error (FALSE) instead of a result set. Put


 $result=mysql_query($query);
 echo mysql_error();

and see what that tells you.

thanks for the response. the results the same. I should have told you, everything seems to work fine - just the message shows up.

Well , maybe its just me, but i see there two lines with mysql_numrows($result); in them.
And in the first instance the $query is most likely would be … emm … empty.

Which exactly is the line nr.17 in your code there ?

thank you so much friend, boy I fought that one, now if I can figure out how put the date in. Once again, thanks

<?php?>
<HTML><HEAD>
<script type="text/javascript">
var dateNow = new Date();
  var dayNow = dateNow.getDate();
  var showdate = (dateNow.getMonth()+1)+"/"+dateNow.getDate()+"/"+dateNow.getFullYear();
showdate.value = showdate;
</script>
</HEAD><body><br><script type="text/javascript">
document.write(showdate);
</script></body></html>
<?php 
include("getinvno.php");  
mysql_connect(localhost,root,""); 
mysql_select_db(oodb) or die( "Unable to select database"); 
// $result=mysql_query($query); 
// $num=mysql_numrows($result); 
$query="SELECT payrec, ordernum, invnum, bname, bstreet, bcity, bstate, bzip, contact, sname, sstreet, scity, sstate, szip, terms, fob, shipdate, shipamt, dateord, datecomp, datepaid, qty, descr, charges, paidamt, tax, amtdue, paidsum FROM oocust WHERE payrec = 'R' AND pd = ' '";
$result=mysql_query($query);  
if(mysql_num_rows($result))  
   {
while(list($payrec, $ordernum, $invnum, $bname, $bstreet, $bcity, $bstate, $bzip, $contact, $sname, $sstreet, $scity, $sstate, $szip, $terms, $fob, $shipdate, $shipamt, $dateord, $datecomp, $datepaid, $qty, $descr, $charges, $paidamt, $tax, $amtdue, $paidsum)= mysql_fetch_row($result))
   { 

// echo "Date: $showdate<br />";
 
echo "Invoice No: $invnum<br />"; 
echo "Old Orchard Plumbing<br />2210 Hogan Hollow Road<br />Margate, Fl  33063<br /><br />";  
echo "Bill To: <br />$bname<br />$bstreet<br />$bcity, $bstate, $bzip<br />"; 
echo "Contact is: $contact<br /><br />";  echo "Ship To: <br />$sname<br />$sstreet<br />$scity, $sstate, $szip<br /><br />";  
echo "Terms: $terms<br />Due Date: $duedate<br />Fob: $fob<br />Ship Date: $shipdate<br />Order No: $ordernum<br /><br />";  
echo "This bill is for: $qty $descr<br />Charges: $charges<br />tax=: $tax <br />Shipment Amt: $shipamt<br />Amount Due: $amtdue<br /><br />";
  }
  }  
?>  

Incidentally you dont really need the num_rows check - a WHILE loop on an empty set will simply not execute.