Jump to content

[SOLVED] INSERTING INTO DATABASE


pgrevents

Recommended Posts

<?php

if ($_POST['part1'] =="yes"){

$name_post = $_POST['contact_name'];
$email_post = $_POST['contact_email'];
$unique_post = rand(487546515116548413561, 156489491961841561654484456216515);
$country_ident = $_POST['country'];
$complete = "complete";
mysql_connect("localhost","user","pass");
mysql_select_db("user");
if(mysql_query("INSERT INTO details (name, email, unique) VALUES('$name_post', '$email_post', '$unique_post' ) ")) 
    {  
    setcookie("first", "complete", time()+3600);
$_SESSION['country'] = $_POST['country'];
    $_SESSION['unique'] = $unique_post;
$_SESSION['email'] = $_POST['contact_email'];
$headerlocation = "1"; 
} 
else 
{
$headerlocation = "2";
}

///blah blah blah rest of it works
?>

 

Hi peeps I ahve pasted the code that is the issue. I have had it working before but as soon as i add the UNIQUE into the mix it throws back mysql error I have set the script to fall back if there is a problem inserting. This is the first time i have seen this message and it was only since I added it to the script. I have tried everything in my knowledge (pretty limited) but still not getting no where.

 

any help would be great

thanks

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/157898-solved-inserting-into-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.