ok this is the existing code:
<?php require_once('Connections/karltest.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 testdb (voornaam, achternaam, email, partysize, huidigjaar) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['voornaam'], "text"),
GetSQLValueString($HTTP_POST_VARS['achternaam'], "text"),
GetSQLValueString($HTTP_POST_VARS['email'], "text"),
GetSQLValueString($HTTP_POST_VARS['partysize'], "int"),
GetSQLValueString($HTTP_POST_VARS['huidigjaar'], "int"));
mysql_select_db($database_karltest, $karltest);
$Result1 = mysql_query($insertSQL, $karltest) or die(mysql_error());
}
mysql_select_db($database_karltest, $karltest);
$query_Recordset1 = "SELECT * FROM testdb";
$Recordset1 = mysql_query($query_Recordset1, $karltest) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
$query = "select sum(partysize) from testdb where huidigjaar = 2002";
$result = mysql_query($query, $karltest);
$row = mysql_fetch_row($result);
echo number_format($row[0]) . " people are signed up for this conference in 2002.";
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Voornaam:</td>
<td><input type="text" name="voornaam" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Achternaam:</td>
<td><input type="text" name="achternaam" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Email:</td>
<td><input type="text" name="email" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Partysize:</td>
<td><input type="text" name="partysize" value="2" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Invoerjaar:</td>
<td><input type="text" name="huidigjaar" value="2002" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Insert Record"></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Could you tell me where i insert this code of yours? π