torquate Posted March 28, 2010 Share Posted March 28, 2010 As stated in the subject. <?php if(isset($_POST['submit'])) { $query = "INSERT into players (name, address, city, state, zip, phone, gender, height, realheight, experience, speed, conditioning, athleticism, hands, commitment, throwing, claim, relationship, teamsport, email, beencaptain, willingcaptain, shirtsize, upa) "; $query .= "VALUES ("; $query .= "'" . $_POST['name'] . "'"; $query .= ",'" . $_POST['address'] . "'"; $query .= ",'" . $_POST['city'] . "'"; $query .= ",'" . $_POST['state'] . "'"; $query .= ",'" . $_POST['zip'] . "'"; $query .= ",'" . $_POST['phone'] . "'"; $query .= ",'" . $_POST['gender'] . "'"; $heightreal = $_POST['feet'] * 12 + $_POST['inches']; switch($_POST['gender']) { case 0: if ($heightreal <= 64) $height = 1; if ($heightreal > 64 && $height < 68) $height = 2; if ($heightreal > 67 && $height < =71) $height = 3; if ($heightreal > 71 && $height < =74) $height = 4; if ($heightreal > 74 ) $height = 5; break; case 1: if ($heightreal <= 59) $height = 1; if ($heightreal > 59 && $height < 64) $height = 2; if ($heightreal > 63 && $height < =68) $height = 3; if ($heightreal > 68 && $height < =70) $height = 4; if ($heightreal > 70 ) $height = 5; break; } $query .= ",'" . $_POST['height'] . "'"; $query .= ",'" . $_POST['feet'] . "." . $_POST['inches'] . "'"; $query .= ",'" . $_POST['experience'] . "'"; $query .= ",'" . $_POST['speed'] . "'"; $query .= ",'" . $_POST['conditioning'] . "'"; $query .= ",'" . $_POST['athleticism'] . "'"; $query .= ",'" . $_POST['hands'] . "'"; $query .= ",'" . $_POST['commitment'] . "'"; $query .= ",'" . $_POST['throwing'] . "'"; if (strlen($_POST['claim'] > 0) { $query .= ",'" . $_POST['claim'] . " (" . $_POST['relationship'] . ")'"; } else { $query .= ",''"; } $query .= ",'" . $_POST['teamsport'] . "'"; $query .= ",'" . $_POST['email'] . "'"; $query .= ",'" . $_POST['beencaptain'] . "'"; $query .= ",'" . $_POST['willingcaptain'] . "'"; $query .= ",'" . $_POST['shirtsize'] . "'"; $query .= ",'" . $_POST['upa'] . "'"; $query .= ")"; $db->execute($query); $id = mysql_insert_id(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/196737-what-is-causing-the-error-in-this-block-of-code/ Share on other sites More sharing options...
zeodragonzord Posted March 28, 2010 Share Posted March 28, 2010 Don't have a space between < and =. Instead, use this: <=. Quote Link to comment https://forums.phpfreaks.com/topic/196737-what-is-causing-the-error-in-this-block-of-code/#findComment-1032857 Share on other sites More sharing options...
torquate Posted March 28, 2010 Author Share Posted March 28, 2010 Thanks for the reply. . .that didn't work. It's definitely this part of the code because the page loads fine if I comment it out. It seems like every line is causing a problem when I try to check it with comments! Quote Link to comment https://forums.phpfreaks.com/topic/196737-what-is-causing-the-error-in-this-block-of-code/#findComment-1032861 Share on other sites More sharing options...
Zane Posted March 28, 2010 Share Posted March 28, 2010 what error? Quote Link to comment https://forums.phpfreaks.com/topic/196737-what-is-causing-the-error-in-this-block-of-code/#findComment-1032864 Share on other sites More sharing options...
torquate Posted March 28, 2010 Author Share Posted March 28, 2010 A blank white page. Quote Link to comment https://forums.phpfreaks.com/topic/196737-what-is-causing-the-error-in-this-block-of-code/#findComment-1032873 Share on other sites More sharing options...
oni-kun Posted March 28, 2010 Share Posted March 28, 2010 A blank white page. Turn error display_errors on, and set error reporting to E_ALL and it should tell you. Quote Link to comment https://forums.phpfreaks.com/topic/196737-what-is-causing-the-error-in-this-block-of-code/#findComment-1032875 Share on other sites More sharing options...
TapeGun007 Posted March 28, 2010 Share Posted March 28, 2010 To turn on error reporting: To turn on Error Reporting in PHP, this is what I use. You can set this anywhere in your PHP code, but it has to be above the error or else it will not work. This is the easiest way and will work in most hosting environments: ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); or if you only want to see Warning Messages and not Notice Messages: ini_set('display_errors',1); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/196737-what-is-causing-the-error-in-this-block-of-code/#findComment-1032878 Share on other sites More sharing options...
torquate Posted March 28, 2010 Author Share Posted March 28, 2010 Thanks for the tips. Unfortunately that still did nothing. I swear I have gone through the code 100 times. Quote Link to comment https://forums.phpfreaks.com/topic/196737-what-is-causing-the-error-in-this-block-of-code/#findComment-1032882 Share on other sites More sharing options...
PFMaBiSmAd Posted March 28, 2010 Share Posted March 28, 2010 You must set the error_reporting/display_errors settings before your script is requested in order to show fatal parse errors. Since your script is never executed, the settings will never be changed when placed in your script. In addition to the problem that zeodragonzord posted (must be fixed in 4 places) there is a missing ) on one of the If() statements. You need to set the error_reporting/display_errors settings in your master php.ini. You will save a TON of time. Stop and start your server to get any change made to the php.ini to take effect. Quote Link to comment https://forums.phpfreaks.com/topic/196737-what-is-causing-the-error-in-this-block-of-code/#findComment-1032884 Share on other sites More sharing options...
torquate Posted March 28, 2010 Author Share Posted March 28, 2010 It was the missing ). Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/196737-what-is-causing-the-error-in-this-block-of-code/#findComment-1032887 Share on other sites More sharing options...
Zane Posted March 28, 2010 Share Posted March 28, 2010 white pages usually mean a database problem... just my experience check your query.. comment out the database query line.. Quote Link to comment https://forums.phpfreaks.com/topic/196737-what-is-causing-the-error-in-this-block-of-code/#findComment-1032890 Share on other sites More sharing options...
inversesoft123 Posted March 28, 2010 Share Posted March 28, 2010 Sometimes in wordpress I experience if you put space after php closing ?> //code ends ?> ////// THIS BLANK SPACE / LINE //////////// Then page shows white screen which is popularly known White screen of Death. Quote Link to comment https://forums.phpfreaks.com/topic/196737-what-is-causing-the-error-in-this-block-of-code/#findComment-1032905 Share on other sites More sharing options...
zeodragonzord Posted March 28, 2010 Share Posted March 28, 2010 What did you want to print on the page? You don't have print() or echo() statements. Quote Link to comment https://forums.phpfreaks.com/topic/196737-what-is-causing-the-error-in-this-block-of-code/#findComment-1032906 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.