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:

  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)

Here is the php code:

// include the database configuration
// connect to database
mysql_select_db($db["database"])  or die ("sorry I couldn't connect to the

// if no connect then exit
// exit;

// if connect successful

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


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

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