Jump to content

create and insert


marcs910

Recommended Posts

Mk. Can some please tell me why "$a = md5(uniqid(rand(),true))" is not inserting my code into my table?

 

if (empty($errors)) {

 

// Register the user in the database.

 

// Check for previous registration.

$query = "SELECT user_id FROM users WHERE email='$e'";

$result = mysql_query($query);

if (mysql_num_rows($result) == 0) {

 

//Create the activate code

 

$a = md5(uniqid(rand(),true));

 

// Make the query.

$query = "INSERT INTO users (first_name, last_name, email, password, company_name, description, address, city, state, zip, phone, fax, cell, web_address, active, registration_date) VALUES ('$fn', '$ln', '$e', SHA('$p'), '$cn', '$desc', '$add', '$city', '$st', '$z', '$ph', '$fax', '$cell', '$web', '$a', NOW() )";

$result = @mysql_query ($query); // Run the query.

if ($result) { // If it ran OK.

 

// Send an email, if desired.

 

// Redirect the user to the thanks.php page.

// Start defining the URL.

$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);

 

// Check for a trailing slash.

if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {

$url = substr ($url, 0, -1); // Chop off the slash.

}

 

// Add the page.

$url .= '/thanks.php';

 

header("Location: $url");

exit();

Link to comment
https://forums.phpfreaks.com/topic/46181-create-and-insert/
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.