Im trying to create a form to insert some data into my database. When i try to submit the form, i get this error message:
Incorrect table name ''
Heres the code dreamweaver inserted into the document:
Code:
<?php require_once('../Connections/dreamcs3.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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 = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO ``position`` (Type) VALUES (%s)",
GetSQLValueString($_POST['position'], "text"));
mysql_select_db($database_dreamcs3, $dreamcs3);
$Result1 = mysql_query($insertSQL, $dreamcs3) or die(mysql_error());
}
mysql_select_db($database_dreamcs3, $dreamcs3);
$query_updateme = "SELECT * FROM `position`";
$updateme = mysql_query($query_updateme, $dreamcs3) or die(mysql_error());
$row_updateme = mysql_fetch_assoc($updateme);
$totalRows_updateme = mysql_num_rows($updateme);
?>
everything is in the database correctly since i can use phpmyadmin to insert the data. Maybe i should copy the php code that i can get into phpmyadmin then get rid of any junk code dreamweaver inserts