what am I doing wrong here? I set this up just to test my results but I'm not getting anything back. I think I'm using the wrong syntax or something. Ultimately, I want to un-comment the code at the bottom. This script deletes a file associated with a database record, then delete the record. The records store
clientid | reportname | filename | path
turns out i don't really need the path because i think unlink() works relatively and all my files are stored in the same place. Anyway, here's what I've got:
$query = "SELECT filename FROM reclamation WHERE reportname='$reportname' AND clientid='$id'";
if ( ! mysql_query( $query, $link ) ) {
print mysql_error();
return false;
}
$filename = mysql_result( $query );
print $filename;
//unlink(../uploads/$filename);
//$delete_record = "DELETE FROM reclamation WHERE reportname='$reportname' AND clientid='$id'";
//if ( ! mysql_query( $delete_record, $link ) ) {
// print mysql_error();
// return false;
//}
In regards to "$filename = mysql_result( $query );" I tested it with just $filename = $query and saw the query exactly as it should be. But then I tried mysql_num_rows to see if anything was there, mysql_fetch_row, mysql_fetch_field - everything I could think of from the manual. All I got were bad result resources and "Wrong parameter count for mysql_result() " I guess I'm just going about this wrong.
Thanks!