Ver Mensaje Individual
  #4 (permalink)  
Antiguo 27/06/2008, 09:13
Avatar de T4ke0veR
T4ke0veR
 
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: eliminar registros??

hacer un archivo q se llame eliminar.php con el codigo como t lo dio emilio o hacer ese mismo archivo con algo asi si lo quieres hacer por DW q no es la mejor solucion pero si funciona!!!

Código PHP:
<?php require_once('Connections/conect.php'); ?>
<?php
function GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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['id'])) && ($_GET['id'] != "")) {
  
$deleteSQL sprintf("DELETE FROM tabla WHERE id=%s",
                       
GetSQLValueString($_GET['id'], "int"));

  
mysql_select_db($database_conect$conect);
  
$Result1 mysql_query($deleteSQL$conect) or die(mysql_error());

  
$deleteGoTo "listado.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$deleteGoTo .= (strpos($deleteGoTo'?')) ? "&" "?";
    
$deleteGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$deleteGoTo));
}
?>
y a los articulos le colocas un boton eliminar con un link algo asi
eliminar.php?id=<?php echo $row_Recordset1['id']; ?> <- DW
eliminar.php?id=<?php echo $row['id'] ?> <- asi a lo normal...
saludos y suerte
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...