Is dat een standaard? Het is iig wel mijn sql-error ondanks een degelijke value
En ik vroeg me af hoe ik deze hele meuk kon submitten met fields leeggelaten
PHP-code:
<?php require_once('../Connections/dbcon.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO huis (oppervlakte, gebouwd, kamers, f01, f02, f03, f04, f05, f06, f07, f08, f09, f10, f11, f12, omschrijving, fs01, fs02, fs03, fs04, fs05, fs06, fs07, fs08, fs09, fs10, fs11, fs12, fl01, fl02, fl03, fl04, fl05, fl06, fl07, fl08, fl09, fl10, fl11, fl12, datum) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['oppervlakte'], "text"),
GetSQLValueString($HTTP_POST_VARS['gebouwd'], "text"),
GetSQLValueString($HTTP_POST_VARS['kamers'], "text"),
GetSQLValueString($HTTP_POST_VARS['f01'], "text"),
GetSQLValueString($HTTP_POST_VARS['f02'], "text"),
GetSQLValueString($HTTP_POST_VARS['f03'], "text"),
GetSQLValueString($HTTP_POST_VARS['f04'], "text"),
GetSQLValueString($HTTP_POST_VARS['f05'], "text"),
GetSQLValueString($HTTP_POST_VARS['f06'], "text"),
GetSQLValueString($HTTP_POST_VARS['f07'], "text"),
GetSQLValueString($HTTP_POST_VARS['f08'], "text"),
GetSQLValueString($HTTP_POST_VARS['f09'], "text"),
GetSQLValueString($HTTP_POST_VARS['f10'], "text"),
GetSQLValueString($HTTP_POST_VARS['f11'], "text"),
GetSQLValueString($HTTP_POST_VARS['f12'], "text"),
GetSQLValueString($HTTP_POST_VARS['omschrijving'], "text"),
GetSQLValueString($HTTP_POST_VARS['fs01'], "text"),
GetSQLValueString($HTTP_POST_VARS['fs02'], "text"),
GetSQLValueString($HTTP_POST_VARS['fs03'], "text"),
GetSQLValueString($HTTP_POST_VARS['fs04'], "text"),
GetSQLValueString($HTTP_POST_VARS['fs05'], "text"),
GetSQLValueString($HTTP_POST_VARS['fs06'], "text"),
GetSQLValueString($HTTP_POST_VARS['fs07'], "text"),
GetSQLValueString($HTTP_POST_VARS['fs08'], "text"),
GetSQLValueString($HTTP_POST_VARS['fs09'], "text"),
GetSQLValueString($HTTP_POST_VARS['fs10'], "text"),
GetSQLValueString($HTTP_POST_VARS['fs11'], "text"),
GetSQLValueString($HTTP_POST_VARS['fs12'], "text"),
GetSQLValueString($HTTP_POST_VARS['fl01'], "text"),
GetSQLValueString($HTTP_POST_VARS['fl02'], "text"),
GetSQLValueString($HTTP_POST_VARS['fl03'], "text"),
GetSQLValueString($HTTP_POST_VARS['fl04'], "text"),
GetSQLValueString($HTTP_POST_VARS['fl05'], "text"),
GetSQLValueString($HTTP_POST_VARS['fl06'], "text"),
GetSQLValueString($HTTP_POST_VARS['fl07'], "text"),
GetSQLValueString($HTTP_POST_VARS['fl08'], "text"),
GetSQLValueString($HTTP_POST_VARS['fl09'], "text"),
GetSQLValueString($HTTP_POST_VARS['fl10'], "text"),
GetSQLValueString($HTTP_POST_VARS['fl11'], "text"),
GetSQLValueString($HTTP_POST_VARS['fl12'], "text"),
GetSQLValueString($HTTP_POST_VARS['datum'], "text"));
mysql_select_db($database_dbcon, $dbcon);
$Result1 = mysql_query($insertSQL, $dbcon) or die(mysql_error());
}
?>