Jump to content

[SOLVED] Updating Database


thomashw

Recommended Posts

The update part of this code isn't working. Can anyone help?

 

if( isset ($_FILES[$filename] ) && ( $_FILES[$filename]['error'] != 4 ) )
{
$query4 = "INSERT INTO uploads ( 
file_name, 
file_size, 
file_type ) 
VALUES ( 
'{$_FILES[$filename]['name']}', 
'{$_FILES[$filename]['size']}', 
'{$_FILES[$filename]['type']}')";
$insert4 = mysql_query( $query4 ) or die( mysql_error() );

$filemoved = false;

do
{
$rand = mt_rand();
$directory = "../images/manu/$image_folder/$image_folder$rand";
if( !file_exists( $directory ) )
{
move_uploaded_file( $_FILES[$filename]['tmp_name'], "$directory" ) or die( mysql_error() );
$filemoved = true;
$newname = "$image_folder$rand";
$oldname = $_FILES[$filename]['name'];
$query5 = "UPDATE uploads SET file_name = {$newname} WHERE file_name = {$oldname}";
$insert5 = mysql_query( $query5 );
}
} while( !$filemoved );
}

 

$image_folder is just a word set above this part of the code.

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/103826-solved-updating-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.