hacer pagina web registro borrar es muy error "Incorrect table name ''
Código HTML:
<a href="borrar.php?id=<?php echo $row_Recordset1['id']; ?>">borrar</a>
Código PHP:
<?php require_once('Connections/sma.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($_POST['id'])) && ($_POST['id'] != "")) {
$deleteSQL = sprintf("DELETE FROM ``noticias-es`` WHERE id=%s",
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_sma, $sma);
$Result1 = mysql_query($deleteSQL, $sma) or die(mysql_error());
$deleteGoTo = "admin.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
$colname_Recordset1 = "-1";
if (isset($_GET['id'])) {
$colname_Recordset1 = $_GET['id'];
}
mysql_select_db($database_sma, $sma);
$query_Recordset1 = sprintf("SELECT * FROM `noticias-es` WHERE id = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $sma) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>
<body>
<p>Nombre:<?php echo $row_Recordset1['titiulo']; ?></p>
<p>texto:<?php echo $row_Recordset1['texto']; ?></p>
<form id="form1" name="form1" method="post" action="">
<input name="id" type="hidden" id="id" value="<?php echo $row_Recordset1['id']; ?>" />
<input type="submit" name="button" id="button" value="Borrar" />
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>