Hi,
ich muss nen Datenbankeintrag machen, ist ja kein Problem, hab mir einfach mal einen von Dreamweaver basteln lassen !!!
Hier der Code
Ich mach das normalerweise so (kurzfassung):
Wo liegt der Unterschied ??? Kann mir das jemand erklären ???
ich muss nen Datenbankeintrag machen, ist ja kein Problem, hab mir einfach mal einen von Dreamweaver basteln lassen !!!
Hier der Code
PHP Code:
<?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 lexikon (id, gruppe, ueberschrift, text) VALUES (%s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['id'], "int"),
GetSQLValueString($HTTP_POST_VARS['gruppe'], "int"),
GetSQLValueString($HTTP_POST_VARS['ueberschrift'], "text"),
GetSQLValueString($HTTP_POST_VARS['text'], "text"));
mysql_select_db($database_db_connect, $db_connect);
$Result1 = mysql_query($insertSQL, $db_connect) or die(mysql_error());
}
?>
PHP Code:
$query = "INSERT INTO members (id,gruppe,ueberschrift,text) VALUES ('','$form_gruppe','$form_ueberschrift','$form_text')";
$result = MYSQL_QUERY($query,$db_connect);
Comment