Current location: Hot Scripts Forums » Programming Languages » PHP » how to enter multiple records


how to enter multiple records

Reply
  #1 (permalink)  
Old 04-02-09, 10:55 PM
reshma reshma is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 38
Thanks: 0
Thanked 2 Times in 2 Posts
how to enter multiple records

Hi

Is there any way in which you can enter muliple records into our database, like if i want to enter 50 records initially and then want to keep adding on records whenever required, how can i do that? do i have to actually hard code the values everytime or is there some other way out ? i hope i am clear
Reply With Quote
  #2 (permalink)  
Old 04-02-09, 11:57 PM
kaceykeleher kaceykeleher is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
You can just create an SQL file to upload into your MySQL database. It would look similar to this:

# --------------------------------------------------------
#
# Table structure for table 'table_name'
#
CREATE TABLE table_name (
user_id mediumint(8) NOT NULL auto_increment,
user_active tinyint(1) DEFAULT '1',
user_name varchar(25) NOT NULL,
user_pass varchar(32) NOT NULL,
PRIMARY KEY (user_id)
);

# -- User Info
INSERT INTO table_name (user_id, user_active, user_name, user_pass) VALUES ( '', '', 'admin', 'password');
INSERT INTO table_name (user_id, user_active, user_name, user_pass) VALUES ( '', '', 'user', 'password');

Then you save the file as filename.sql, and run it in your MySQL database. You'd have to create the INSERT INTO line 50 times, and change the user_name (for this particular insert) but it's easier than creating a form and entering the data for each one. I think, anyway.
__________________
"Where's that Peter Griffin? He told me he'd give me a hundred fifty bucks if I took off all my clothes off." - Peter Griffin, Family Guy

W3Schools - You'll be surprised what you can learn on your own!

Last edited by kaceykeleher; 04-03-09 at 12:01 AM.
Reply With Quote
  #3 (permalink)  
Old 04-03-09, 12:12 AM
reshma reshma is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 38
Thanks: 0
Thanked 2 Times in 2 Posts
Thanks a lot !!! i will try this out...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
perl multiple selection of records bangarushiva Perl 1 12-05-08 08:46 PM
Update Multiple Records cancer10 ASP 6 10-25-06 02:55 AM
displaying records across multiple columns eddo32 PHP 3 04-29-05 02:54 PM
stuck on updating multiple records us0r PHP 6 05-20-04 11:19 PM


All times are GMT -5. The time now is 08:32 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.