<?php
$tables = array('table1', 'table2'); // add the valid tablename here
$fields = array('field_in_table_1', 'field_in_table_2');
foreach($_POST AS $key=>$value) {
if (in_array($key, $tables)) {
$fieldkey = array_search($key, $tables);
$query = "INSERT INTO $key(" . $fields[$fieldkey] . ") VALUES($value)";
// insert code here
// mysql_query($query, $db);
}
}
?>
ok i got the tables and fields ok in the $tables and $ fields ok -
but do i need to
a) write a seperate sql query for each individual table?
b) what am i meant to insert here??
mysql_select_db($database_chalbysmaster, $chalbysmaster);
$query_rsprefix = "SELECT prefix FROM prefix ORDER BY prefix ASC";
$rsprefix = mysql_query($query_rsprefix, $chalbysmaster) or die(mysql_error());
$row_rsprefix = mysql_fetch_assoc($rsprefix);
$totalRows_rsprefix = mysql_num_rows($rsprefix);
do i have to create that for each table insert?
thanks