Foros del Web » Programando para Internet » PHP »

eliminar registros??

Estas en el tema de eliminar registros?? en el foro de PHP en Foros del Web. hola quisiera saber que debo hacer para borrar los registros php asi como ingreso quiero tener el link de eliminar por favor ayuda... tengo 3 ...
  #1 (permalink)  
Antiguo 26/06/2008, 18:02
 
Fecha de Ingreso: junio-2008
Mensajes: 25
Antigüedad: 15 años, 10 meses
Puntos: 0
eliminar registros??

hola quisiera saber que debo hacer para borrar los registros php asi como ingreso quiero tener el link de eliminar por favor ayuda... tengo 3 tablas uso phpmyadmin, apache, appserve, dream para editar php
por favor ayuda se los agradeceria
  #2 (permalink)  
Antiguo 26/06/2008, 20:07
Avatar de emiliodeg  
Fecha de Ingreso: septiembre-2005
Ubicación: Córdoba
Mensajes: 1.830
Antigüedad: 18 años, 8 meses
Puntos: 55
Respuesta: eliminar registros??

lo que necesitas es algunas funciones php para ejecutar mysql

mysql_query('delete from tabla where id=\'1\'');

ese seria un ejemplo para borra el registro con id igual a 1 en la tabla tabla
__________________
Degiovanni Emilio
developtus.com
  #3 (permalink)  
Antiguo 27/06/2008, 09:06
 
Fecha de Ingreso: junio-2008
Mensajes: 25
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: eliminar registros??

pero como hago eso en drea. porq para ahcer el ingreso yo coloco un juego de regitro inserto formulario.. uy despues un tabla dinamica y region repetida y listo ya se carga el regitro
pero como lo elimino asi mismo? con chebox?
  #4 (permalink)  
Antiguo 27/06/2008, 09:13
Avatar de 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 ...
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:27.