Jump to content

ok simpole insert into ...... but not submitting to DB ...... Why?


hopbop

Recommended Posts

So did the error checking nothing comes back as error it's connecting fine the POST info is being stored correctly in the verbals and the sql array is all in correct order and spelling is right ....... why is not it saving to DB. I have a feeling it's something silly that I am missing hence why I am posting it I need some fresh eyes on this.

 

 

<?php
$ecs = 'James';
if (isset($_POST['agency_contacts'])) $agency_contacts = $_POST['agency_contacts']; else $agency_contacts = 'N/A';			
if (isset($_POST['newsletters'])) $newsletters = $_POST['newsletters']; else $newsletters = 0; 
if (isset($_POST['flyers'])) $flyers = $_POST['flyers']; else $flyers = 0;
if (isset($_POST['brochures'])) $brochures = $_POST['brochures']; else $brochures = 0;
if (isset($_POST['posters'])) $posters = $_POST['posters']; else $posters = 0;
if (isset($_POST['high_educaiton_fair'])) $high_educaiton_fair = $_POST['high_educaiton_fair']; else $high_educaiton_fair = 0;
if (isset($_POST['website'])) $website = $_POST['website']; else $website = 0;
if (isset($_POST['public_service_announcements'])) $public_service_announcements = $_POST['public_service_announcements']; else $public_service_announcements = 0;
if (isset($_POST['press_releases'])) $press_releases = $_POST['press_releases']; else $press_releases = 0;
if (isset($_POST['special_presentations'])) $special_presentations = $_POST['special_presentations']; else $special_presentations = 0;
if (isset($_POST['Inservices'])) $Inservices = $_POST['Inservices']; else $Inservices = 0;
if (isset($_POST['other'])) $other = $_POST['other']; else $other = NULL;

$host = "localhost";
$user = "root";
$pass = "";
$db_name = "learn_sym";
$con = mysql_connect("$host","$user","$pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db($db_name, $con);
$sql = "INSERT INTO outreach (id, dte, ecs, agency_contacts, newsletters, flyers, brochures, posters, high_educaiton_fair, website, public_service_announcements, press_releases, special_presentations, Inservices, other) 
VALUES (NULL, now(), '$ecs','$agency_contacts','$newsletters','$flyers','$brochures','$posters','$high_educaiton_fair','$website','$public_service_announcements','$press_releases','$special_presentations','$Inservices', '$other')";

		if (isset($sql,$con))
				{
					header("Location: market.php");
				}
			else
				{
					die('Error: ' . mysql_error());
				}
	mysql_close();
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.