updates in the table are shown after 2nd reload (mysql) why this happens and the updates are not shown in first time?
I am using a colorbox(edit the record) to display the form,The form has the field to upload a video file... When any file uploaded it is converted to .flv i am using ffmpeg.
while clicking submit button in this pop up box the popup closes and the paren开发者_JAVA技巧t page refreshs.
but after refreshs the it shows the old file....if i again refresh it it shows the newly uploaded file...wat happining here....
i am using codeignitor....
thanks
You probably have your code structured something like this:
$id = intval($_REQUEST['id']);
// load the video info
$video = $db->fetch('SELECT * FROM videos WHERE id = ?', $id);
// check for new file
if (isset($_FILES['video_file']) && $_FILES['video_file']['error'] == UPLOAD_ERR_OK) {
// process the new file
move_uploaded_file($_FILES['video_file']['tmp_name'], 'video_files/' . $id);
// update the video info in the DB
$db->update('UPDATE videos SET file_name = ? WHERE id = ?', $_FILES['video_file']['name'], $id);
}
// return the video info
echo 'Your video file is ' . $video['file_name'];
The problem here is that you are loading the video before you're updating it. You just need to make sure that you're doing your SQL UPDATE before your SELECT.
加载中,请稍侯......
精彩评论