php parses but no data inserted

From: Date: Tue, 21 Sep 2004 13:37:39 +0000
Subject: php parses but no data inserted
Groups: php.general 
Request: Send a blank email to php-general+get-197416@lists.php.net to get a copy of this message
hi there, the following code runs but no message is displayed from the if then else statement at the end of the script. also, nothing is written to the database. i have checked the insert statement and the login credentials are correct.does anyone know what might be causing this? thanks, lukemack. <?php /* TITLE: Inmarsat Form handling script AUTHOR: Luke Mackenzie DATE: 18/09/04 */ error_reporting(E_ALL); // if the submit buttons has been pressed if (isset($_POST['submit'])){ //connect to the server and select the database include "mysql.connect.php";// include the connection details @mysql_select_db("inmarsat_comp") or die ("Could not select Database"); // retrieve the posted information from the form $firstname = $_POST["first_name"]; $lastname = $_POST["last_name"]; $jobtitle = $_POST["job_title"]; $company = $_POST["company"]; $address1 = $_POST["address1"]; $address2 = $_POST["address2"]; $address3 = $_POST["address3"]; $city = $_POST["city"]; $county = $_POST["state"]; $postcode = $_POST["postcode"]; $telcode = $_POST["telephone_cc"]; $telnumber = $_POST["telephone_no"]; $faxcode = $_POST["fax_cc"]; $faxnumber = $_POST["fax_no"]; $email = $_POST["email_address"]; foreach($_POST["markets1"] AS $enterprise); $distribute = $_POST["OKToDistr"]; $market = $_POST["OKToMarket"]; //insert info into query string $query = "INSERT INTO inmarsat_comp SET firstname='$firstname', lastname='$lastname'"; //run the query $result = mysql_query($query); if ($result) echo "<p>Form Data Successfully inserted!</p>"; else echo "<p> There was a problem inserting the form Data!</p>"; mysql_close(); } ?>

« previous php.general (#197416) next »