Jump to content

MySQL Table Stucture!


DJTim666

Recommended Posts

mysql_query("INSERT INTO `users` ( `id` , `username` , `password` , `email` , `rp` , `gender` , `birthday` , `date_registered` )
VALUES (
NULL , '$user', '$pass', '$email', '2500', '$gender', '$birthday', '$date'
);");

 

Can anyone help me make a table structure for that information please :D

Link to comment
https://forums.phpfreaks.com/topic/52157-mysql-table-stucture/
Share on other sites

<?php
mysql_query("CREATE TABLE users(
id INT NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(id),
username VARCHAR(30), 
password VARCHAR(30), 
email VARCHAR(30), 
rp VARCHAR(30), 
gender VARCHAR(7), 
birthday DATETIME, 
)")
or die(mysql_error());  

echo "Table Created!";
?>

 

The lengths (the numbers in the brackets) will have to be changed to suit your needs and I don't know what type of data you are using for gender or date, but this will give you an idea of how to do it. 

Link to comment
https://forums.phpfreaks.com/topic/52157-mysql-table-stucture/#findComment-257275
Share on other sites

Is date in the database set for a Date Format?  If so the date format for MySQL is Y-m-d (2007-05-19).  Inserting anything that is not in that format will be messed up. Now if your Date row is varchar then you shouldn't have a problem using the format you have now. But if it is set for DATE you will have problems.

Link to comment
https://forums.phpfreaks.com/topic/52157-mysql-table-stucture/#findComment-257296
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.