rondog Posted September 27, 2007 Share Posted September 27, 2007 I have a video.php page that a user is able to input client, title, location description, ect into a text field. When you hit submit, it reloads the page, but has the previous results. So the UPDATE statement is working, its just not outputting the correct changes. Here is my php <?php include 'connect.php'; $flashurl = $_GET['vid']; $c_loc = $_GET['cam']; $t_loc = $_GET['tape']; $filename = str_replace("cam_$c_loc/tape_$t_loc/","","$flashurl"); $capCam = strtoupper($c_loc); $vidcall = "$filename.flv"; $curP = $_SERVER['PHP_SELF']; $submiturl = "$curP?vid=$flashurl&cam=$c_loc&tape=$t_loc"; //show results already in the DB $query = mysql_query("SELECT client,title,segtitle,location,dateshot,rights,keywords FROM videos WHERE vidname = '$vidcall'") or die(mysql_error()); $row = mysql_fetch_row($query) or die(mysql_error()); $submit = $_POST['Submit']; $client = $_POST['client']; $title = $_POST['title']; $segtitle = $_POST['segement']; $location = $_POST['location']; $date = $_POST['date']; $rights = $_POST['rights']; $searchtags = $_POST['searchtags']; if($submit != "" ) { $query = mysql_query("UPDATE videos SET client = '$client', title = '$title', segtitle = '$segtitle', location = '$location', dateshot = '$date', rights = '$rights', keywords = '$searchtags' WHERE vidname = '$vidcall'") or die(mysql_Error()); } ?> I thought that if I do it the way I currently have it setup it, you hit submit it sends the new results, the page comes up again and selects the new results. Thats not the case however. How could I just submit and output the results they just entered? thanks. Quote Link to comment https://forums.phpfreaks.com/topic/70931-solved-update-statement-not-echoing-out-correct-results-until-refresh/ Share on other sites More sharing options...
Psycho Posted September 27, 2007 Share Posted September 27, 2007 You need to change your code to do the UPDATE before the SELECT. Quote Link to comment https://forums.phpfreaks.com/topic/70931-solved-update-statement-not-echoing-out-correct-results-until-refresh/#findComment-356575 Share on other sites More sharing options...
rondog Posted September 27, 2007 Author Share Posted September 27, 2007 well damn that was easy thank you! Quote Link to comment https://forums.phpfreaks.com/topic/70931-solved-update-statement-not-echoing-out-correct-results-until-refresh/#findComment-356581 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.