SMGames
07-03-2007, 08:35 AM
Can anyone help me, i am trying to insert the date and time into a table, so when someone registers it shows the date and time or when they register.
This is my insert code:
<?php session_start(); ?>
<?php
$username="****";
$password="****";
$database="****";
mysql_connect('************',$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$loginname=$_POST['loginname'];
$password=$_POST['password'];
$createdate=$_POST['createdate'];
$name=$_POST['name'];
$age=$_POST['age'];
$location=$_POST['location'];
$description=$_POST['description'];
$email=$_POST['email'];
$warn=0;
$noblog="This user has not created a page yet";
$query="INSERT INTO users (
loginname,
password,
createdate
name,
age,
location,
description,
email,
warn)
VALUES (
'$loginname',
'$password',
'$createdate
'$name',
'$age',
'$location',
'$description',
'$email',
'$warn'
)";
$result=mysql_query($query);
?>
At the moment it shows 0000-00-00 along with the username, password etc. Can anyone show me how to show the date and time of when they registerd
Just if you need it, this is the code that i userd to create my users trable:
<?php
$username="*****";
$password="*****";
$database="*****";
mysql_connect('***********',$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$query="CREATE TABLE users(
id INT NOT NULL AUTO_INCREMENT,
createdate DATE NOT NULL,
loginname VARCHAR(20) NOT NULL,
password VARCHAR(20) NOT NULL,
name VARCHAR(40),
age INT(2),
location VARCHAR(40),
description CHAR(255),
email VARCHAR(40) NOT NULL,
warn INT,
PRIMARY KEY(id))";
$result=mysql_query($query) or die(mysql_error());
?>
This is my insert code:
<?php session_start(); ?>
<?php
$username="****";
$password="****";
$database="****";
mysql_connect('************',$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$loginname=$_POST['loginname'];
$password=$_POST['password'];
$createdate=$_POST['createdate'];
$name=$_POST['name'];
$age=$_POST['age'];
$location=$_POST['location'];
$description=$_POST['description'];
$email=$_POST['email'];
$warn=0;
$noblog="This user has not created a page yet";
$query="INSERT INTO users (
loginname,
password,
createdate
name,
age,
location,
description,
email,
warn)
VALUES (
'$loginname',
'$password',
'$createdate
'$name',
'$age',
'$location',
'$description',
'$email',
'$warn'
)";
$result=mysql_query($query);
?>
At the moment it shows 0000-00-00 along with the username, password etc. Can anyone show me how to show the date and time of when they registerd
Just if you need it, this is the code that i userd to create my users trable:
<?php
$username="*****";
$password="*****";
$database="*****";
mysql_connect('***********',$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$query="CREATE TABLE users(
id INT NOT NULL AUTO_INCREMENT,
createdate DATE NOT NULL,
loginname VARCHAR(20) NOT NULL,
password VARCHAR(20) NOT NULL,
name VARCHAR(40),
age INT(2),
location VARCHAR(40),
description CHAR(255),
email VARCHAR(40) NOT NULL,
warn INT,
PRIMARY KEY(id))";
$result=mysql_query($query) or die(mysql_error());
?>