Jump to content

php/mysql help


davelearning

Recommended Posts

Hi all,

 

I am relatively new to php and am stuck on a simple query, I just dont know what my error is.

Basically I am just trying to save some information to a database and I am getting:

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key) VALUES ('testuser','dc23053d9ada11806420839fd42aa9c9','admin@jollyhosting' at line 1Something Went Wrong = Please click back and try again

 

The code I am using is

<?php
include('config.php');
require('class.phpmailer.php');

$username = $_POST['username'];
$hide = md5($_POST['password']);
$password = $hide;
$email = $_POST['email'];
$number = rand();
$key = md5($number);

$query ="INSERT INTO user (username, password, email, key)
VALUES
('$username','$password','$email', '$key')";

if (!mysql_query($query))
{
echo mysql_error();
echo "Something Went Wrong = Please click back and try again";
}

 

Many thanks for anyhelp

 

Link to comment
https://forums.phpfreaks.com/topic/223489-phpmysql-help/
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.