Foros del Web » Programando para Internet » PHP »

borrar registro my sql

Estas en el tema de borrar registro my sql en el foro de PHP en Foros del Web. hola a todos.... lo que pasa es que tengo quiero hacer una pagina que me borre registros de my sql.... el problema es con el ...
  #1 (permalink)  
Antiguo 26/01/2007, 16:38
Avatar de jotaincubus  
Fecha de Ingreso: mayo-2005
Ubicación: Medellin - Colombia
Mensajes: 1.797
Antigüedad: 19 años
Puntos: 394
borrar registro my sql

hola a todos....

lo que pasa es que tengo quiero hacer una pagina que me borre registros de my sql.... el problema es con el id no tengo mucho conocimiento de eso.... lo estoy haciendo en dreamweaver y el tiene la opcion... pero no queiere funcionar....
en mysql el campo que estoy utilizando como clave el "usuarios" pero cuando le doy variable de sesion y escojo ese campo en toda la configuracion no me quiere funcionar....

gracias por su ayuda....
__________________
Por que existe gente que no agradece después de que se le ha brindado tiempo y ayuda ???
  #2 (permalink)  
Antiguo 27/01/2007, 00:51
Avatar de Gurrutello  
Fecha de Ingreso: enero-2002
Ubicación: Ontario,Toronto [Canada]
Mensajes: 2.017
Antigüedad: 22 años, 3 meses
Puntos: 6
Re: borrar registro my sql

Hola, lo mejor es que pongas el codigo que tienes para hecharle un vistazop
saludos
__________________
Un Saludo
www.tutores.org
Asp | Php | Javascript | Perl | Coldfusion | Flash | +- 2000 codigos
  #3 (permalink)  
Antiguo 27/01/2007, 11:11
Avatar de eits  
Fecha de Ingreso: junio-2005
Ubicación: valladolid, yucatán
Mensajes: 1.655
Antigüedad: 18 años, 10 meses
Puntos: 88
Re: borrar registro my sql

una idea es:

DELETE FROM nombre_tabla WHERE nombre_campo=valor_a_eliminar;

eso sería mas o menos así, pero, como dice gurrutelo lo mejor es que pongas tu código, para darnos una idea de como pretendes borrarlo(campo clave), es decir, saber cual es tu base de datos, tablas y campos, para saber como construir la consulta(query) y si ya tienes la conexión, etc.

saludos
__________________
El amor es la locura mas lucida que tiene el hombre.- Andres Henestrosa
la tristeza no existe, solo es... la ausencia de la felicidad.
  #4 (permalink)  
Antiguo 30/01/2007, 09:13
Avatar de jotaincubus  
Fecha de Ingreso: mayo-2005
Ubicación: Medellin - Colombia
Mensajes: 1.797
Antigüedad: 19 años
Puntos: 394
Re: borrar registro my sql

tratare de colocar el codigo fuente...
__________________
Por que existe gente que no agradece después de que se le ha brindado tiempo y ayuda ???
  #5 (permalink)  
Antiguo 30/01/2007, 09:15
Avatar de jotaincubus  
Fecha de Ingreso: mayo-2005
Ubicación: Medellin - Colombia
Mensajes: 1.797
Antigüedad: 19 años
Puntos: 394
Re: borrar registro my sql

Cita:
<?php require_once('Connections/proyecto.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?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($_POST['cedula'])) && ($_POST['cedula'] != "") && (isset($_SESSION['MM_Username']))) {
$deleteSQL = sprintf("DELETE FROM usuarios WHERE cedula=%s",
GetSQLValueString($_POST['cedula'], "int"));

mysql_select_db($database_proyecto, $proyecto);
$Result1 = mysql_query($deleteSQL, $proyecto) or die(mysql_error());

$deleteGoTo = "login.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
?>
__________________
Por que existe gente que no agradece después de que se le ha brindado tiempo y ayuda ???
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 04:11.