I'm new to databases, well i got the database to work, i made a table and database, and its connecting, but now i made a user list for people to log on... now, its not very complicated, i made 6 fields in the table: ID, date, name, email, username, pass.
here is my script, do i have to add like, a hidden input, or something how can i create random ID numbers for ID??
<?
if ((!$name) || (!$email) || (!$username) || (!$password)) {
header("Location: [url]http://www.designingonweb.com/show_adduser.html[/url]");
exit;
}
$db_name = "designingonweb_com";
$table_name = "users";
$connection = @mysql_connect("localhost", "fred", "********")
or die("Couldn't connect.");
$db = mysql_select_db($db_name, $connection)
or die("Couldn't select database.");
$sql = "INSERT INTO $table_name
(name, email, username, password)
VALUES
(\"$name\", \"$email\",\"$username\",password(\"$password\"))
";
$result = mysql_query($sql,$connection)
or die("Couldn't execute query.");
?>
<HTML>
<HEAD>
<TITLE>Add a User</TITLE>
</HEAD>
<BODY>
<H1>Added to user list:</H1>
<P><STRONG>Full Name:</STRONG><BR>
<? echo "$name"; ?></p>
<P><STRONG>E-mail:</STRONG><BR>
<? echo "$email"; ?></p>
<P><STRONG>Username:</STRONG><BR>
<? echo "$username"; ?></p>
<P><STRONG>Password:</STRONG><BR>
<? echo "$password"; ?></p>
<P><a href="show_adduser.html">Add Another</a></p>
</BODY>
</HTML>
Thanks for your time and help..