Q:

Getting error in upload php

I am getting this error in my code now:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/valerie2/public_html/elinkswap/snorris/upload.php on line 83

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/valerie2/public_html/elinkswap/snorris/upload.php on line 84

here is my line of code:
79.dbConnect();
80.  $SQL="SELECT fileId FROM upload WHERE fileName='".$result."'"; 
81.  //echo $SQL;
82.  $rs=mysql_query($SQL);
83.  echo mysql_num_rows($rs);
84.  if(mysql_num_rows($rs)!=0){
85.      $extension=strrchr($result,'.'); 
86.      $result=str_replace($extension,time(),$result);
87.      $result=$result.$extension;
88. } 
89.  return $result;
90.} 

Thanks. 
This is also another error I am getting..
Warning: imagejpeg() [function.imagejpeg]: Unable to open '/home/valerie2/public_html/elinkswap/upload/tmb-desert.jpg' for writing: No such file or directory in /home/valerie2/public_html/elinkswap/snorris/upload.php on line 55

Warning: imagejpeg() [function.imagejpeg]: Unable to open '/home/valerie2/public_html/elinkswap/upload/desert.jpg' for writing: No such file or directory in /home/valerie2/public_html/elinkswap/snorris/upload.php on line 56

   53.  imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
    54.  if (is_numeric(strpos($type,"jpeg"))){
    55.      imagejpeg($dst_img,"/home/valerie2/public_html/elinkswap/upload/".$thumbFilename);
    56.  imagejpeg($src_img,"/home/valerie2/public_html/elinkswap/upload/".$filename);
        }
  57.    if (is_numeric(strpos($type,"png"))){
        58.  imagepng($dst_img,"/home/valerie2/public_html/elinkswap/upload/".$thumbFilename);
        59.  imagepng($src_img,"/home/valerie2/public_html/elinkswap/upload/".$filename);
        }

Sorry everyone I am still learning the file upload stuff. 

A:

Its because you have something wrong with your query 
try this and but back the error msg 
 82  $rs=mysql_query($SQL) or die(mysql_error());

The above code will terminate the script with the error msg from the SQL if exists 

