![]() |
|
#1
|
|||
|
|||
php insert functionhi guys. i have a little bit problem. now, i'm developing a very simple system. it include inserting multiple row concurrently.
normally, when we click submit button, the data will be inserted into one row, so now i want it be when we click submit, all the data will be inserted into multiple row concurrently. row[0]=Banana row[1]=Carrot row[3]=pineapple ... by single clicking. |
|
#2
|
|||
|
|||
Re: php insert functionMore info please. I guess I am not quite seeing what your trying to do.
|
|
#3
|
||||
|
||||
Re: php insert functionRead this howto I wrote many years ago, maybe it will point you in the right direction.
http://www.desilva.biz/mysql/insert.html __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#4
|
|||
|
|||
Re: php insert functionQuote:
ok.. the situation is like this; banana = 1st row pineapple = 2nd row apple = 3rd row ... to insert such 3 items, i have to click submit button 3 times. first click, banana will be inserted into 1st row, and if i have 10 items, i need 10 clicking. so now i want to save times by insert all the items by single clicking. it mean, all the items inserted into different row concurrently. |
|
#5
|
|||
|
|||
Re: php insert functionQuote:
it almost same, but i use a variable. $fruit = banana $fruit = pineapple $fruit = apple ... $sql = "INSERT INTO fruits(name, quantity) VALUES ('$fruit', '$qtt')"; is it possible if such 3 items inserted all at once |
|
#6
|
|||
|
|||
Re: php insert functionPHP Code:
try something like: PHP Code:
or, programatically, you will have to create an array containing the fruits and qty's, then compose a query string smt. like this: PHP Code:
Of course, the fruits and qty arrays will have the corresponding values you need. Or, you can use an associative and/or multidimensional array. Best Regards, PcFan Last edited by JdS : 13-Dec-2006 at 04:38.
Reason: Please insert your PHP code between [php] & [/php] tags
|
|
#7
|
||||
|
||||
Re: php insert functionWhy thank you, PcFan
I just pulled up this thread to reply and you did it already! Again, thank you. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#8
|
|||
|
|||
Re: php insert functioni've tried the script given by PcFan, but it appear an error pointing at for loop, so i change the loop to be like this;
PHP Code:
also not work and only the last row get into the dbase. |
|
#9
|
||||
|
||||
Re: php insert functionI'll try to correct some of the typos in PcFan's example code...
PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
NARMY by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Message Class | TransformedBG | CPP / C++ Forum | 5 | 29-Nov-2006 21:28 |
| [Include] Doubly-linked List | dsmith | C Programming Language | 6 | 14-Apr-2006 13:12 |
| [Tutorial] Function Pointers | aaroncohn | CPP / C++ Forum | 4 | 17-Feb-2006 11:33 |
| Revising Script style ?????? | pepee | MySQL / PHP Forum | 4 | 14-Apr-2004 04:59 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The