![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
20/06/2011, 19:08
|
| | Fecha de Ingreso: octubre-2009
Mensajes: 38
Antigüedad: 15 años, 3 meses Puntos: 0 | |
Respuesta: Actualizar multiples registros, no actualiza gracias de nuevo,
te dejo el codigo completo, como veras soy nuevo en esto, y este es el codigo generado por dreamweaver, ya me estoy dando cuenta k lo mejor es empezar desde cero, en rojo esta lo k me haz ayudado a checar ya con la modificacion k me haz dado:
<?php require_once('Connections/movi.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "http://www.google.com";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?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 = "entra.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
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
$colname_Recordset1 = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_Recordset1 = $_SESSION['MM_Username'];
}
mysql_select_db($database_movi, $movi);
$query_Recordset1 = sprintf("SELECT * FROM ususb WHERE USUARIO = %s", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $movi) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$colname_datos = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_datos = $_SESSION['MM_Username'];
}
mysql_select_db($database_movi, $movi);
$query_datos = sprintf("SELECT * FROM pedido WHERE usuario = %s", GetSQLValueString($colname_datos, "text"));
$datos = mysql_query($query_datos, $movi) or die(mysql_error());
$row_datos = mysql_fetch_assoc($datos);
$totalRows_datos = mysql_num_rows($datos);
?>
<!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>Untitled Document</title>
</head>
<body> <form action="modificar.php" method="POST" name="form1" id="form1">
<table width="571" border="0">
<?php while ($row_datos = mysql_fetch_assoc($datos)) { ?>
<tr>
<td><?php echo $row_datos['PAT']; ?></td>
<td><label><?php echo $row_datos['MAT']; ?></label></td>
<td><?php echo $row_datos['NOM']; ?></td>
<td><label>
<input type="checkbox" name="movi" value= "<?php echo $row_datos['movi']; ?>" />
</label>
<input type="hidden" name="ID" value="<?php echo $row_datos['ID']; ?>"/></td>
<td><?php echo $row_datos['SEC']; ?></td>
</tr>
<?php } ?>
</table>
<p>
<label>
<input type="submit" name="hgty" id="hgty" value="ENVIAR" /> </label>
<a href="<?php echo $logoutAction ?>">Cerrar</a></p>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($datos);
?>
Y EL DE ACTUALZIACION ES ESTE:
<?php require_once('Connections/movi.php');
$prueba = $_POST['ID'];
$nombre = $_POST['movi'];
var_dump($prueba, $nombre);
mysql_query("UPDATE pedido SET movi='$nombre' WHERE id='$prueba'");
?>
<BR>
<Center>
<A HREF="pedir.php"> Regresar </A>
</Center>
DE NUEVO, MUCHISIMAS GRACIAS!!! |