Jump to content

can somebody please look at my queries?


esandra

Recommended Posts

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.

Link to comment
Share on other sites

Your queries are failing due to some kind of error and assuming you have not changed your code, it is likely a problem with the database server, with your database, or with your table.

 

If you echo mysql_error(); on the next line after the line with your mysql_query() statements, it will tell you why the query(ies) are failing.

Link to comment
Share on other sites

Try This

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 billnmbr 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 billnmbr='$billnmbr' 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;
}
}

 

OR

Add

 or die(mysql_error()) ;

Thats at the End of Both

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.