|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate 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
|
|||
|
|||
|
INSERT question
Hi,
I have a page with multiple checkboxes that I then use to populate a table with those chosen... using this code: $insert_act = "INSERT INTO `actlookup` (`acID`, `vID`, `actID`) VALUES ('', '', '')"; while(list($keyc, $Act) = each($acts)) { $insert_act .= ", ('', '$vID', '$Act') "; } $query = ($insert_act); $result = mysql_query($query); But as you can see I have used an empty row insert to allow me to use subsequent commas for the additional chosen options. Is there a way to use the first array item ($acts[0]) for this empty line and then the subsequent items in the latter code? I'm not sure if I've made this clear, let mme know. Cheers Klyve |
|
#2
|
|||
|
|||
|
RE: INSERT question
|
|
#3
|
|||
|
|||
|
RE: INSERT question
Thanks, that works great but I don't understand how it does work! It appears to still leave the trailing comma on the INSERT statement and in the past I haven't managed to get that to work.
Klyve |
|
#4
|
|||
|
|||
|
RE: INSERT question
That ereg_replace() should remove the trailing comma. You can also use substr($insert_act,0,strlen($insert_act)).
|
|
#5
|
|||
|
|||
|
RE: INSERT question
It doesn't appear so if I print the query to the screen but as it works I must assume it knocks the trailing comma off.
Thanks Klyve |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > INSERT question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|