<?php
$con = mysql_connect('localhost', 'leto_hostes', 'password_hidden');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("letohost_player", $con);
$sql="INSERT INTO `letohost_user`.`player` (`USER_ID` ,`USERNAME` ,`PASSWORD` ,`EMAIL` ,`POSITION` ,`ACTIVE` ,`MEMBER` )
VALUES (NULL , '$_POST[register_username]', 'md5($_POST[register_password])', '$_POST[register_email]', '0', '0', '0');)";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
leto-hostes.com
0
Newbie Poster
Recommended Answers
Jump to PostYes EE.
$sql="INSERT INTO `letohost_user`.`player` (`USER_ID` ,`USERNAME` ,`PASSWORD` ,`EMAIL` ,`POSITION` ,`ACTIVE` ,`MEMBER` )
VALUES (NULL , '$_POST[register_username]', 'md5($_POST[register_password])', '$_POST[register_email]', '0', '0', '0');)";But LH, please use the correct syntax. Even with encased array vars, the array member should be quoted - either with single or double quotes:
Jump to Postno quotes on table names column names
mysql_query("INSERT INTO Persons (FirstName, LastName, Age) VALUES ('Peter', 'Griffin', '35')"); // so $sql="INSERT INTO letohost_user.player (USER_ID, USERNAME, PASSWORD, EMAIL, POSITION, ACTIVE, MEMBER) VALUES (NULL, {$_POST['register_username']}, {md5($_POST['register_password']}), {$_POST['register_email']}, '0', '0', '0');)";
Jump to Postnot added, example code only
read the link provided to find the correct format and edit your code
All 10 Replies
leto-hostes.com
0
Newbie Poster
ElegantElephant
0
Light Poster

diafol
leto-hostes.com
0
Newbie Poster
leto-hostes.com
0
Newbie Poster
almostbob
866
Retired: passive income ROCKS
leto-hostes.com
0
Newbie Poster
almostbob
866
Retired: passive income ROCKS
leto-hostes.com
0
Newbie Poster

diafol
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.