can somebody please look at my queries?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
esandra
Forum Newbie
Posts: 24
Joined: Sun Aug 30, 2009 11:11 pm

can somebody please look at my queries?

Post by esandra »

ive had these queries working okay until i checked on it today, it's not working anymore..
these are the errors:::
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\arrastre\add.php on line 105
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\arrastre\add.php on line 117


if(isset($_POST['add'])){
if($billnmbr=="" or $orno=="" or $payor=="" or $arrastre=="" or $wharfage=="" or $total=="" or $date=="" or $tcl==""){
echo "At least one field was left blank.";
}
else{
$query = mysql_query("select * from `arrastre` WHERE `billnmbr`='$billnmbr'"); /*****************this is my line 105************/
$count = mysql_num_rows($query);
if($count==1){
echo "This billnumber is already in the database.";
}

else{
$bll = strtoupper($billnmbr);
$payr = strtoupper($payor);
$query="insert into `arrastre` (`billnmbr`, `orno`, `payor`, `arrastre`, `wharfage`, `total`, `date`, `tcl`)
values ('$bll', '$orno', '$payr', '$arrastre', '$wharfage', '$total', '$date', '$tcl')";
$result=mysql_query($query);

$query = mysql_query("select * from `arrastre` where `billnmbr`= '$billnmbr'", $link); /************and this is my line 117*************/
$count = mysql_num_rows($query);
if($count==1){
echo "last bill number added: ".$billnmbr;
}
}
Thank you very much for your time and have a nice day.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: can somebody please look at my queries?

Post by requinix »

mysql_query failed. Use mysql_error to find out what's wrong.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: can somebody please look at my queries?

Post by Jonah Bron »

Yup. From the manual:
PHP Manual wrote:... returns a resource on success, or FALSE on error.
Post Reply