Error Mysql "incorrect table name"
Me gustaría solicitar tu ayuda con un problema que tengo con php y Mysql.
Resulta que estoy realizando una acción para eliminar registros de una base de datos.
Estoy trabajando con Dreamweaver Cs6.
Entonces aparentemente ha quedado todo bien pero cuando lo pruebo en el navegador saca un mensaje que dice "Incorrect table name '' ".
He realizado este proceso muchas veces con paginas anteriores pero jamas me había sacado un error como este.
El nombre de la tabla se llama: trabajos-realizados.
A continuación pego el código generado por el dreamweaver Cs6.
Muchas gracias.
Saludos.
<?php require_once('../Connections/conexion.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $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; } } if ((isset($_GET['recordid'])) && ($_GET['recordid'] != "")) { $deleteSQL = sprintf("DELETE FROM ``trabajos-realizados`` WHERE idContador=%s", GetSQLValueString($_GET['recordid'], "int")); mysql_select_db($database_conexion, $conexion); $Result1 = mysql_query($deleteSQL, $conexion) or die(mysql_error()); $deleteGoTo = "index.php"; if (isset($_SERVER['QUERY_STRING'])) { $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?"; $deleteGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $deleteGoTo)); } ?>
2 Respuestas
Respuesta de beocidio
1
Respuesta de Jorge Vila
-1