newlearner2005
Programmer
Hello Everybody
I have successfully uploaded and downloaded data files to MySQL database by using PHP scripts.
On my webpage I can "open" or "save" that file by clicking on it. Everything is fine. But I did not have a choice to delete it.
I had to write some PHP scripts as follow:
// delete the row from the database
$query = "DELETE FROM upload WHERE postId='$postId'";
$result = mysql_query( $query );
// print out the results
if( $result )
{
echo( "Successfully deleted the file." );
}
else
{
die( "Error: Could not delete file: " . mysql_error() );
}
Eventhough it said "Successfully delete the file" but I still see that file on my webpage. I checked MySQL database, it is still there.
Can anybody help me how to delete a file from MySQL database by using PHP. (I know how to delete it from MySQL command prompt)
Thank you very much.
new learner2005
I have successfully uploaded and downloaded data files to MySQL database by using PHP scripts.
On my webpage I can "open" or "save" that file by clicking on it. Everything is fine. But I did not have a choice to delete it.
I had to write some PHP scripts as follow:
// delete the row from the database
$query = "DELETE FROM upload WHERE postId='$postId'";
$result = mysql_query( $query );
// print out the results
if( $result )
{
echo( "Successfully deleted the file." );
}
else
{
die( "Error: Could not delete file: " . mysql_error() );
}
Eventhough it said "Successfully delete the file" but I still see that file on my webpage. I checked MySQL database, it is still there.
Can anybody help me how to delete a file from MySQL database by using PHP. (I know how to delete it from MySQL command prompt)
Thank you very much.
new learner2005