Hi,

It's me bothering you great helpers again! Wondering if you can help me?
I know I am missing something stupid cause I am taking this pretty much
straight out
of  the PHP 4 Bible.

Here is my table dump:


CREATE TABLE users (
  uid int(10) unsigned NOT NULL auto_increment,
  name varchar(20) NOT NULL default '',
  password varchar(20) NOT NULL default '',
  class tinyint(3) unsigned NOT NULL default '0',
  realname varchar(40) default NULL,
  email varchar(50) NOT NULL default '',
  sex enum('Male','Female') default NULL,
  session varchar(15) NOT NULL default '',
  dateregistered datetime NOT NULL default '0000-00-00 00:00:00',
  dateactivated datetime NOT NULL default '0000-00-00 00:00:00',
  lastvisit datetime NOT NULL default '0000-00-00 00:00:00',
  logins int(10) unsigned NOT NULL default '0',
  points int(11) NOT NULL default '1000',
  PRIMARY KEY  (uid),
  UNIQUE KEY name (name,email)
) TYPE=MyISAM;


Here is the php code:

<?
// include the database configuration
include"config.php";
// connect to database
mysql_connect($db["host"],$db["user"],$db["password"]);
mysql_select_db($db["database"])  or die ("sorry I couldn't connect to the
database.");

// if no connect then exit
// exit;

// if connect successful

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<body>
<?
<?
if(!IsSet($stage))
          {
?>

Please fill out the form below to get an account.
<FORM METHOD="POST" ACTION="te.php">
Username:<BR><INPUT TYPE=TEXT NAME="name" SIZE=15><BR>
<input type=hidden name="stage" value=1>
<INPUT TYPE=SUBMIT>
</form>
<?
$query = "INSERT INTO users (uid, name) VALUES(NULL, $name)";
$result = mysql_query($query);
if($result == 0)
print("There has been a problem.");
else
print("Your information has been recorded.");
}
 ?>
</body>
</html>

All I want is to get the username into the database.
As soon as test.php shows in browser, the Username, submit button and box ar
e there but also
it prints the "There has been a problem." right off the bat. Now I know
there are misprints in the book
and I hope I was smart enough to catch them but maybe not. can someone
please tell me what I have
done wrong?

Thanks for all your time.

Jennifer Downey



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to