mi bd : usuarios
CREATE TABLE IF NOT EXISTS `usuarios` (
`usuario_id` int(12) unsigned NOT NULL AUTO_INCREMENT,
`nombre_user` varchar(60) NOT NULL,
`nombre` varchar(40) NOT NULL,
`apellido` varchar(40) NOT NULL,
`password` varchar(40) NOT NULL,
`email` varchar(40) NOT NULL,
`fecha` date NOT NULL,
`control` enum('admin','user','premium') NOT NULL DEFAULT 'user',
`estado` enum('a','i') NOT NULL,
PRIMARY KEY (`usuario_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
Una vez dado SI , va ir a :
eliminar_user.php
entonces , aqui es donde debo trabajar lo que es la eliminacion logica ; pero como asignarlo.
Código PHP:
Ver original<?php require_once('Connections/con_usuarios.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
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['nombre_user'])) && ($_GET['nombre_user'] != "")) { $deleteSQL = sprintf("DELETE FROM usuarios WHERE nombre_user=%s", GetSQLValueString($_GET['nombre_user'], "text"));
$deleteGoTo = "listado_users.php";
if (isset($_SERVER['QUERY_STRING'])) { $deleteGoTo .= (strpos($deleteGoTo, '?')) ?
"&" : "?"; $deleteGoTo .= $_SERVER['QUERY_STRING'];
}
}
$colname_usuario = "-1";
if (isset($_GET['nombre_user'])) { $colname_usuario = $_GET['nombre_user'];
}
$query_usuario = sprintf("SELECT * FROM usuarios WHERE nombre_user = %s", GetSQLValueString
($colname_usuario, "text")); ?>
<!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"><!-- InstanceBegin template="/Templates/base.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Documento sin título</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
margin-top: 0px;
background-image: url(fondo.jpg);
background-repeat: repeat-x;
}
-->
</style>
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>
<body>
<table width="80%" border="0" align="center">
<tr>
<td align="center" bgcolor="#6DC1F0"><h1> control de usuarios<br />
</h1></td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><!-- InstanceBeginEditable name="contenido" -->reemplazar<!-- InstanceEndEditable --></td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>
<?php
?>