Forum Moderators: coopster
$filename = $_FILES['uploadfile']['name'];
$query = "SELECT * FROM $table";
$result = mysql_query($query, $conn);
while ($checkfile = mysql_fetch_assoc($results)){
$existfile = $checkfile['filename'];
}//end while
if ($existfile == $filename){
print "A file with that name already exists.";
}
else {
some script that adds the file info to $table
}
Now, this combination of while and if statements will only catch a match with an already existing filename if the already existing filename was the last one to be updated. I've tried adding the if and else statements into the while statement but then the file info gets added to the table multiple times. Does anyone have any ideas? Am I even making any sense?
$query = "SELECT count(*) as fcount FROM $table where file_field_name_column = '".mysql_escape_string($_FILES['uploadfile']['name'])."'";
could be used to check if an email name and customer name both existed in your database so you did not add a duplicate? Sorry if it's a dumb question, but I'm a serious newbie...
John