MySQL insert

They have: 3 posts

Joined: Nov 2010

Hey, I have a problem, which i can't figure out..
I have one form from which i am inserting the info into three separate form in mysql. Everything works fine, with exception to the first form, where the last two colums are not filled in. I cannot figure it out why is it so.

Hope somebody will give me some advice.

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Hi kei, welcome to TWF Smiling

Can you post your SQL statement to insert the form data?

They have: 3 posts

Joined: Nov 2010

Hi! Thanks and in advance want to apologize if there were spelling mistakes in the previous post... (blush)

So, here is the code:

//Personoplysninger
$fn = $_POST['fn'];
$en = $_POST['en'];
$email = $_POST['email'];
$mnr = $_POST['mnr'];
$adr = $_POST['adr'];
$pnr = $_POST['pnr'];
$town = $_POST['town'];
$land = $_POST['land'];

//Harddiskoplysninger
$mark = $_POST['mark'];
$model = $_POST['model'];
$snr = $_POST['snr'];
$size = $_POST['size'];

//Salgssted
$f = $_POST['f'];
$fid = $_POST['fid'];
$date = $_POST['date'];

$sql_0 = "INSERT INTO Personoplysninger (Fornavn, Efternavn, Email, Mobilnr, Adresse, Postnr, Town, Land) VALUES ('".$fn."', '".$en."', '".$email."', '".$mnr."', '".$adr."', '".$pnr."', '".$town."', '".$land."')";
//execute query
$exec = mysql_query($sql_0, $con);
if(!$exec){

die('Could not insert into personoplysninger: \n' . mysql_error());
}else{echo 'Inserted successfully into personoplysninger \n';}
//create query
//insert into harddiskoplysninger table
$sql_1 = "INSERT INTO Harddiskoplysninger(Maerke, Model, Serienr, Storrelse) VALUES ('".$mark."', '".$model."', '".$snr."', '".$size."')";
$exec = mysql_query($sql_1, $con);

if(!$exec){

die("Could not insert into harddiskoplysninger: \n" . mysql_error());
}else{ echo "Inserted successfully into harddiskoplysninger \n";}

//create query
//insert into salgssted table
$sql_2 = "INSERT INTO Salgssted(Forhandler, Forhandler_ID, Dato_for_kob) VALUES ('".$f."', '".$fid."', '".$date."')";
$exec = mysql_query($sql_2, $con);
if(!$exec){

die("Could not insert into salgssted: \n" . mysql_error());
}else{echo "Inserted successfully into salgssted \n";}

As you can see, I have three forms. Everything works just fine with all the fields, but in the first form the last two fields - Town and Land - they just do not want to go into the db table Sad And I really cannot figure out why, as I am using the same code.

The MySQL version is 5, the php is 5.2, i think, the coding in the html file is utf-8, in the db is utf-unicode-ci (the universal one)

Thanks in advance for any help! Smiling

He has: 10 posts

Joined: Jan 2011

Quote:
Hi! Thanks and in advance want to apologize if there were spelling mistakes in the previous post... (blush)

Hi kei ,

You have provided accurate solution. Basically i also facing this problem. Thanks for this information.

They have: 1 posts

Joined: Jan 2011

A frequent difficulty with some Industrial is that the gearbox and bearing program are not created at the same time as they needs to be and can break or put on out over time. Nevertheless, this Ice-Matic ice maker machine functions a bearing and gear assembly that has been fully redesigned to eradicate any such difficulties. The heavy-duty gearbox and roller bearings are extremely powerful and durable, and they're checked by an advanced load monitoring method that can shut down the machine just before any critical harm may be brought on. The ice machine is also equipped with an exceptionally effective air-cooled condenser that utilizes substantially much less water than a lot of other models and is extremely effortless to clean and install. These functions support make this a single of essentially the most reliable, longest lasting ice maker price inside the market.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.