12-26-2010, 03:14 PM
|
#4 (permalink)
|
|
The Acquainted
Join Date: Nov 2009
Location: nr Stratford-Upon-Avon
Posts: 137
Thanks: 3
|
Time to build the sql ...
Code:
$sql = "INSERT INTO table(col1, col2, col3) VALUES ";
$columns = array(($_REQUEST['col1']),($_REQUEST['col2']),($_REQUEST['col3']));
for ($i=0; $i < count($_REQUEST['col1']); $i++) {
$sql .= "(";
$sql .= $_REQUEST['col1'][$i]. ",";
$sql .= $_REQUEST['col2'][$i]. ",";
$sql .= $_REQUEST['col3'][$i]. "),";
}
// Lets have a look at the final sql..
echo $sql . "<br />";
So, need to take the , off the end of the sql...
Code:
echo substr($sql, 0, -1);
And I think thats it about done..
Sorry for going on, but I thought I would ask the question, then figured out how to do it, I hope someone else gets some use out of this
P.S. Not tried it yet so don't know if it works !
__________________
Thanks... Simon
Sex, Drugs & Linux Rules
|
|
|