Forum Moderators: coopster
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table>
<th>Row Number</th>
<th>Year</th>
<th>Data</th>
<?php
$i=0;
while($i<$fieldnumbers){
$i_actual=$i+1;
echo "<tr>
<td>$i_actual:</td>
<td><input type='text' name='date[]'/></td>
<td><input type='text' name='value[]'/></td>";
$i++;
}
?>
<tr>
<td> </td>
<td> </td>
<input type="hidden" name="MM_insert" value="form1" />
<input type="hidden" name="companyidfinal" value="<?php echo $companyID; ?>" />
<input type="hidden" name="typefinal" value="<?php echo $type; ?>" />
<td><input type="submit" value="Insert New Data" /></td>
</table>
</form>
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO datadetail (companyid, `date`, type, `value`) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['companyidfinal'], "text"),
GetSQLValueString($_POST['date'], "date"),
GetSQLValueString($_POST['typefinal'], "text"),
GetSQLValueString($_POST['value'], "text"));
mysql_select_db($database_data, $connection);
$Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());
$insertGoTo = "../manage.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
for($i = 0, $c = count($dates); $i < $c; $i++) {
$indate=$dates[$i];
$incomanyid=$companyidfinal;
$intype=$typefinal;
$invalue=$value[$i];
$incategory=$category;
$indetail=$detail[$i];
echo $indate . $incomanyid . $intype . $invalue . $incategory . $indetail;
$insertSQL = sprintf("INSERT INTO datadetail (`category`, companyid, `date`, type, `value`, `detail`) VALUES (%s, %s %s, %s, %s, %s)",
GetSQLValueString($incategory, "text"),
GetSQLValueString($incompanyid, "text"),
GetSQLValueString($indate, "date"),
GetSQLValueString($intype, "text"),
GetSQLValueString($invalue, "text"),
GetSQLValueString($indetail, "text"));
mysql_select_db($database_EngineerOpediaGIS, $EngineerOpediaGIS);
$Result1 = mysql_query($insertSQL, $EngineerOpediaGIS) or die(mysql_error());
}
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2006-01-00', 'Price', '2400', 'D37 Smooth')' at line 1