mysql - users DB

Codes here !

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 60
Joined: Sun Feb 02, 2003 2:10 am
Location: Leeds, Uk

Wed Feb 26, 2003 3:58 am

i have recently started making a tutorials site for c++ and other things with a friend, i started with a create users code(create.php). theuser fills in a form and the results are POSTed to a .php file and entered to a db, the thing is, not everthing is entered to the db:


Code: Select all


//connect to MYSQL
$connect=mysql_connect("localhost","***","***") or die ("sorry unable to connect(1)".mysql_error());

//select database
$DB=mysql_select_db(tut_site, $connect) or die ("sorry unable to select DB".mysql_error());

//setting-up query
$query="INSERT INTO `users` (`id`, `user`, `password`, `email`, `website`, `joined`, `age`, `interests`, `desc`) VALUES ('', '$_POST[user]', '$_post[password]', '$_POST[email]', '$_POST[website]', '', '$_POST[age]', '$_post[interests]', '$_post[desc]')";
//sending query to server, if error, MYSQL will break out of query and send error to browser
mysql_query($query) or die ("Sorry unable to connect(2)".mysql_error());

//informing user of success
echo("Your user:<b>$_POST[user]</b>, was created");


Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Create New User</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<body text="#FF0000">
<p><font face="Arial Black, Comic Sans MS">Please fill in the below from and your
  account will be created:</font></p>
<p><font face="Arial, Helvetica, sans-serif">All fields mark with a * <strong>must</strong>
  be filled in </font></p>
<form name="Create User" method="post" action="create.php">
  <table width="75%" height="343" border="0" cellspacing="2">
      <td width="18%">User Name:*</td>
      <td width="82%"><input type="text" name="username"></td>
      <td>Password: *</td>
      <td><input type="text" name="password"></td>
      <td><input type="text" name="website"></td>
      <td><input type="text" name="age"></td>
      <td><input type="text" name="interests"></td>
      <td><textarea name="desc" cols="50" rows="10"></textarea></td>
  <table width="75%" border="0" cellspacing="2">
    <input name="Submit" type="submit"  value="Create">

cany anybody help, as i cant see a problem
Keep it punk!!
Peace Out

New php-forum User
New php-forum User
Posts: 67
Joined: Mon Feb 24, 2003 2:55 am
Location: ../Ukraine/Kherson

Wed Feb 26, 2003 4:40 am

Use $_POST["..."];
Don't use $_post["..."]
PHP+MySql= Love :)

Post Reply