List:General Discussion« Previous MessageNext Message »
From:Jim Faucette Date:November 15 1999 10:42pm
Subject:Re: Inserting into a Table
View as plain text  
Since you didn't say what version you're using this assumes a later
version that supports the INSERT INTO ... SET syntax:
INSERT INTO graduates SET name='value', email='value', grad_year=value,
university='value', major='value', phone_number='value',
comment='value', entry_date=now(), password=password('value');

entry_number will autoincrement beginning with 1.

To test a password:
SELECT * FROM graduates WHERE password=password('value');

   jim...

Elliot L. Tobin wrote:
> 
> mysql> describe graduates;
> +--------------+-------------+------+-----+---------+----------------+
> | Field        | Type        | Null | Key | Default | Extra          |
> +--------------+-------------+------+-----+---------+----------------+
> | entry_number | int(11)     |      | PRI | 0       | auto_increment |
> | name         | varchar(30) | YES  |     | NULL    |                |
> | email        | varchar(40) | YES  |     | NULL    |                |
> | grad_year    | int(4)      | YES  |     | NULL    |                |
> | university   | varchar(60) | YES  |     | NULL    |                |
> | major        | varchar(50) | YES  |     | NULL    |                |
> | phone_number | varchar(12) | YES  |     | NULL    |                |
> | comment      | text        | YES  |     | NULL    |                |
> | entry_date   | date        | YES  |     | NULL    |                |
> | password     | varchar(15) | YES  |     | NULL    |                |
> +--------------+-------------+------+-----+---------+----------------+
> 
> Can somebody help me insert some values into this table?  Everytime I try
> to add something, I get a syntax error.  In doing this, I want the
> entry_id to start at 0, and the increment by 1 per record, as I believe it
> is setup to do.  Also, I want entry_date to automatically insert the
> current date..  This last place, I believe, is where the problem stems.  I
> have tried using now() and date() in PHP.
> 
> Additionally, can I have password be encrypted, and later tested with some
> value that is input by the user?  I want to store a password initially,
> and if the user (from the Web) wants to edit their entry, they must enter
> their email_address and password, but I don't want password to be stored
> as clear-text.  Thanks for the help.
Thread
Inserting into a TableElliot L. Tobin16 Nov
  • Re: Inserting into a TableSteve Ruby16 Nov
  • Re: Inserting into a TableJim Faucette16 Nov