Current location: Hot Scripts Forums » Programming Languages » PHP » pls help...!!!


pls help...!!!

Reply
  #1 (permalink)  
Old 10-27-09, 07:06 AM
swap_ssj swap_ssj is offline
Newbie Coder
 
Join Date: Aug 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
pls help...!!!

hi guyes....

for the first time i came across the scenario like this.
can anyone tell me, how to insert multiple records in the same table under the same unique id dynamically...???

in my application, user selects year and month. then according to that month, user will have to insert specific no. of records (i.e. 31 records for January, 28 records for February).

so, i've to insert multiple entries for the same month in a same table, under same unique id.
can anyone tell me how can i acheive this...???
Reply With Quote
  #2 (permalink)  
Old 10-27-09, 07:34 AM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by swap_ssj View Post
in my application, user selects year and month. then according to that month, user will have to insert specific no. of records (i.e. 31 records for January, 28 records for February).
can anyone tell me how can i acheive this...???
Use a loop to insert the required number of entries, something like this:
PHP Code:

$num_records 31;


for(
$i=1$i=$num_records$i++){
     
//...your SQL code goes here
    
$sql INSERT INTO mytable (idnameinfoVALUES ('$id''Bob''')";
    
$sql_result = mysql_query($sql);


This will insert 31 records for January as per the '$num_records' variable
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
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
[SOLVED] Pls Help Me! tharsoe PHP 3 11-06-08 12:28 PM
Simple PHP FLAT file pls help...thanks yugi PHP 10 09-01-08 01:44 AM
Pls help website problem! iangarrinud CSS 1 01-03-08 01:48 PM
Can some one help me code this cart pls pls REDGUNNER PHP 0 08-15-06 10:22 AM


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