|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
how to insert multiple data?
i have another question here..
in many programs, we can just insert data to database.. but what if i got a lot of data, (in my program, i can add or delete criteria) and would like to use all of them to do some mathematical counts and generate graph?.. please help me.. this is really important to my final project.. tq.. |
|
#2
|
|||
|
|||
|
dear cute linda
one suggestion is to use arrays.
__________________
Rathaur ====================== Knowledge is Power |
|
#3
|
|||
|
|||
|
still blur..
can i mel u rathaur? what's ur mel?
|
|
#4
|
|||
|
|||
|
really stuck..
let's say this is example of my interface..
criteria weightage Alternative A |scale A |Alternative B |Scale C 1. Price 0.6 $100 8 $250 7 2. Colour 0.3 Green 4 Blue 6 3. Age 0.1 3 years 5 7 years 8 and now, i would like to know, how i can put the data (criteria, value of weightage, value of Alternative A, value of scale A,value of Alternative B, value of scale B in database so that i can use all of them to count and generate graph especially the weightage and scale? Last edited by lindacomel : August 21st, 2002 at 01:16 AM. |
|
#5
|
|||
|
|||
|
hmm, well, it depends on how you has create your database . Your database should have fields and colomns appropriately to hold all the values. Later in presenting in graph, read from database, present in any chart.
err err, am I rite ? |
|
#6
|
|||
|
|||
|
probs..
the problem is how to hold all the values?
Last edited by lindacomel : August 21st, 2002 at 07:55 AM. |
|
#7
|
|||
|
|||
|
Hi cute linda,
First I hope I am answering correctly for you. This simple script shows a multiple entry form for 6 items. I am using array to hold each items properties. All your values are now assigned to arrays. Upon sumbitting, the values are preserved as they are entered. This will enable you to use another for loop , to insert the values into database. Hope this helps. <? // this part prints the form if (!$submit) { $numentry=10; echo"<table width=650 cellpadding=2 cellspacing=5>"; echo"<tr width='650'>"; echo"<td>num</td><td>entry1</td><td>entry2</td> <td>entry3</td><td>entry4</td>"; echo"<td>entry5</td><td>entry6</td></tr>"; echo"<form action=$PHP_SELF method=post>"; for($j=1;$j<=$numentry;$j++) { //$fac ="fac_".$j; echo "<tr width='650'><td>$j.</td>"; echo "<td><input type='text' name=val[$j] ></td>"; echo "<td><input type='text' name=val2[$j] > </td>"; echo "<td><input type='text' name=val3[$j]> </td>"; echo "<td><input type='text' name=val4[$j] > </td>"; echo "<td><input type='text' name=val5[$j] > </td>"; echo "<td><input type='text' name=val6[$j] > </td></tr>"; } echo "<tr width=650 ><td align='center'> <input type='submit' value='Add' name='submit'> ||"; echo " <input type='reset' value='Clear' name='reset'></td></tr></table></form>"; } if($submit) { //connect to db //error checking //here goes your insert queries for($j=1;$j<=num$entry;$j++) { $sql='insert into $table values("$val[$j]",.....$val[$j])/'; //run your query } } |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > how to insert multiple data? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|