Last active
August 29, 2015 13:56
-
-
Save iva29234/8943650 to your computer and use it in GitHub Desktop.
modificarTodoBUENO.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php require_once('Connections/conec.php'); ?> | |
<?php | |
if (!function_exists("GetSQLValueString")) { | |
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") | |
{ | |
if (PHP_VERSION < 6) { | |
$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; | |
} | |
} | |
$editFormAction = $_SERVER['PHP_SELF']; | |
if (isset($_SERVER['QUERY_STRING'])) { | |
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); | |
} | |
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { | |
$updateSQL = sprintf("UPDATE items SET Nombre=%s, Apellido=%s, Dni=%s, Cantidad=%s, Actualizado=%s WHERE idItems=%s", | |
GetSQLValueString($_POST['Nombre'], "text"), | |
GetSQLValueString($_POST['Apellido'], "text"), | |
GetSQLValueString($_POST['Dni'], "int"), | |
GetSQLValueString($_POST['Cantidad'], "int"), | |
GetSQLValueString($_POST['Actualizado'], "date"), | |
GetSQLValueString($_POST['idItems'], "int")); | |
mysql_select_db($database_conec, $conec); | |
$Result1 = mysql_query($updateSQL, $conec) or die(mysql_error()); | |
//$updateGoTo = "informe.php?"; | |
$updateGoTo = "./informe.php?dummy=0"; | |
if (isset($_SERVER['QUERY_STRING'])) { | |
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; | |
$updateGoTo .= $_SERVER['QUERY_STRING']; | |
} | |
header(sprintf("Location: %s", $updateGoTo)); | |
} | |
$colname_alumnos = "-1"; | |
if (isset($_GET['idItems'])) { | |
$colname_alumnos = $_GET['idItems']; | |
} | |
mysql_select_db($database_conec, $conec); | |
$query_alumnos = sprintf("SELECT * FROM items WHERE idItems = %s ORDER BY Nombre ASC", GetSQLValueString($colname_alumnos, "int")); | |
$alumnos = mysql_query($query_alumnos, $conec) or die(mysql_error()); | |
$row_alumnos = mysql_fetch_assoc($alumnos); | |
$totalRows_alumnos = mysql_num_rows($alumnos); | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Aplic. Web de jQuery Mobile</title> | |
<!-- | |
<script src="../jquery-mobile/jquery-1.6.4.min.js" type="text/javascript"></script> | |
<script src="../jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script> | |
<link href="../jquery-mobile/jquery.mobile-1.0.min.css" rel="stylesheet" type="text/css"> | |
--> | |
<title>Documento sin título</title> | |
</head> | |
<body> | |
<div data-role="page" id="page"> | |
<div data-role="header"> | |
<h1 align="center"> MODIFICAR</h1> | |
<a href="#" data-rel="back" data-icon="arrow-l" data-iconpos="notext">Atrás</a> | |
</div> | |
<div data-role="content" data-theme="e"> | |
<form method="post" name="form1" action="<?php echo $editFormAction; ?>"> | |
<table align="center"> | |
<tr valign="baseline"> | |
<td nowrap align="right">Nombre:</td> | |
<td><input type="text" name="Nombre" value="<?php echo htmlentities($row_alumnos['Nombre'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td> | |
</tr> | |
<tr valign="baseline"> | |
<td nowrap align="right">Apellido:</td> | |
<td><input type="text" name="Apellido" value="<?php echo htmlentities($row_alumnos['Apellido'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td> | |
</tr> | |
<tr valign="baseline"> | |
<td nowrap align="right">Dni:</td> | |
<td><input type="text" name="Dni" value="<?php echo htmlentities($row_alumnos['Dni'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td> | |
</tr> | |
<tr valign="baseline"> | |
<td nowrap align="right">Cantidad:</td> | |
<td><input type="text" name="Cantidad" value="<?php echo htmlentities($row_alumnos['Cantidad'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td> | |
</tr> | |
<tr valign="baseline"> | |
<td nowrap align="right"> </td> | |
<td><input type="submit" value="Actualizar registro" ></td> | |
</tr> | |
</table> | |
<input type="hidden" name="MM_update" value="form1"> | |
<input type="hidden" name="idItems" value="<?php echo $row_alumnos['idItems']; ?>"> | |
</form> | |
</div> | |
<div data-role="footer" data-position="fixed"> | |
<h4>@Ivan L.Ss</h4> | |
</div> | |
</div> | |
</body> | |
</html> | |
<?php | |
mysql_free_result($alumnos); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment