monkeypaw201 Posted February 24, 2008 Share Posted February 24, 2008 i have the following code that spits a blank page at me.. any ideas? <?php if($_POST['select'] == 'Approved']{ if($_POST['old_status'] == 'Approved'] { $thours = $_POST['time_pilot_total']; $mhours = $_POST['time_pilot_member']; $pireps = $_POST['total_pireps']; $vmoney = $_POST['current_money']; }else{ $thours = $_POST['time_pilot_total']+$_POST['time']; $mhours = $_POST['time_pilot_member']+$_POST['time']; $pireps = $_POST['total_pireps']+1; $vmoney = $_POST['current_money']+$_POST['route_money']; } }elseif($_POST['select'] == 'Filed']{ $thours = $_POST['time_pilot_total']; $mhours = $_POST['time_pilot_member']; $pireps = $_POST['total_pireps']; $vmoney = $_POST['current_money']; }elseif($_POST['select'] == 'Denied']{ $thours = $_POST['time_pilot_total']; $mhours = $_POST['time_pilot_member']; $pireps = $_POST['total_pireps']; $vmoney = $_POST['current_money']; } $con = mysql_connect("localhost","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); mysql_query("UPDATE users SET total_hous = '$thours',member_hours = '$mhours',total_pireps = '$pireps',virtual_money = '$vmoney' WHERE pilot_id = '$_POST[pilot_id]'"); mysql_close($con); $con = mysql_connect("localhost","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); mysql_query("UPDATE pireps SET status=%s, date_approved=%s, staff_comments=%s, approved_by=%s WHERE id=%s WHERE id = '$_POST[id]'"); mysql_close($con); ?> I know i dont need to open the connection twice, but i like it that way, so dont comment on it unless it is the problem Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted February 24, 2008 Share Posted February 24, 2008 i suggest adding or die(mysql_error()) after your mysql_query()s. don't know why you'd open the connection twice. Quote Link to comment Share on other sites More sharing options...
themistral Posted February 24, 2008 Share Posted February 24, 2008 Not sure if it's the cause, but look at this line. }elseif($_POST['select'] == 'Filed']{ You are ending your statement with a square bracket instead of rounded -should be }elseif($_POST['select'] == 'Filed'){ If it's not that, let me know! Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted February 24, 2008 Share Posted February 24, 2008 and if you're just getting a 'blank screen', you might want to turn on error reporting so you know if your code won't compile. Quote Link to comment Share on other sites More sharing options...
Bauer418 Posted February 24, 2008 Share Posted February 24, 2008 You're ending all of your parenthetical statements with brackets, which isn't right. Otherwise, what are you expecting to be output? This page would output nothing if it all went as it should. Quote Link to comment Share on other sites More sharing options...
revraz Posted February 24, 2008 Share Posted February 24, 2008 Also, you probably have a typo here total_hous I would think that would be total_hours for your UPDATE query. Turn on error reporting so you will get errors instead of blank pages. Quote Link to comment Share on other sites More sharing options...
monkeypaw201 Posted February 24, 2008 Author Share Posted February 24, 2008 Also, you probably have a typo here total_hous I would think that would be total_hours for your UPDATE query. Turn on error reporting so you will get errors instead of blank pages. nope, its a typo in the database, too much hassle to update all the pages.. You're ending all of your parenthetical statements with brackets, which isn't right. Otherwise, what are you expecting to be output? This page would output nothing if it all went as it should. I fixed this, the new top portion: if($_POST['select'] == 'Approved'){ if($_POST['old_status'] == 'Approved'] { $thours = $_POST['time_pilot_total']; $mhours = $_POST['time_pilot_member']; $pireps = $_POST['total_pireps']; $vmoney = $_POST['current_money']; }else{ $thours = $_POST['time_pilot_total']+$_POST['time']; $mhours = $_POST['time_pilot_member']+$_POST['time']; $pireps = $_POST['total_pireps']+1; $vmoney = $_POST['current_money']+$_POST['route_money']; } }elseif($_POST['select'] == 'Filed'){ $thours = $_POST['time_pilot_total']; $mhours = $_POST['time_pilot_member']; $pireps = $_POST['total_pireps']; $vmoney = $_POST['current_money']; }elseif($_POST['select'] == 'Denied'){ $thours = $_POST['time_pilot_total']; $mhours = $_POST['time_pilot_member']; $pireps = $_POST['total_pireps']; $vmoney = $_POST['current_money']; } Not sure if it's the cause, but look at this line. }elseif($_POST['select'] == 'Filed']{ You are ending your statement with a square bracket instead of rounded -should be }elseif($_POST['select'] == 'Filed'){ If it's not that, let me know! Its not that.. i suggest adding or die(mysql_error()) after your mysql_query()s. don't know why you'd open the connection twice. As i said, i have my stupid habits, and thats one of them.. Quote Link to comment Share on other sites More sharing options...
monkeypaw201 Posted February 24, 2008 Author Share Posted February 24, 2008 Just an update, i fixed another typo ( '' ), and now it displays success, but nothing gets update ??? ??? ??? Quote Link to comment Share on other sites More sharing options...
monkeypaw201 Posted February 24, 2008 Author Share Posted February 24, 2008 DISREGARD!!! FIXED !!! ;D Forgot to defin %s Quote Link to comment 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.