thomashw Posted May 2, 2008 Share Posted May 2, 2008 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 More sharing options...
conker87 Posted May 2, 2008 Share Posted May 2, 2008 $query5 = "UPDATE uploads SET file_name = '{$newname}' WHERE file_name = '{$oldname}'"; Link to comment https://forums.phpfreaks.com/topic/103826-solved-updating-database/#findComment-531555 Share on other sites More sharing options...
thomashw Posted May 2, 2008 Author Share Posted May 2, 2008 Perfect, thanks! Link to comment https://forums.phpfreaks.com/topic/103826-solved-updating-database/#findComment-531742 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.