Click to See Complete Forum and Search --> : Incorrect table name '' in Dreamweaver


sc908
07-31-2008, 11:34 AM
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:
<?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

lsaranchova
09-08-2009, 01:47 PM
Hi SC908,
I have the same troubles. Have you found a solution?

shelley7753
09-16-2009, 10:51 PM
I am having the same problem. everything was fine before. i found that if you remove the two tildes that they place on either side of the table name, the operation works. But WHY should I have to do that every time. is there a bug in dreamweaver? i just got the cs4 or whatever a month ago, but this is the first time i have had this error.

shelley

lionel_php
11-02-2009, 04:41 AM
I am having the same problem. everything was fine before. i found that if you remove the two tildes that they place on either side of the table name, the operation works. But WHY should I have to do that every time. is there a bug in dreamweaver? i just got the cs4 or whatever a month ago, but this is the first time i have had this error.

shelley

Thanks Shelley,

I've had the "two tildes that they place on either side of the table name" problem and you saved me some crazy moments ;-)

then , do you even know now why it happens?

Thanks

Lionel