lo amigos espero me puedan ayudar una vez mas, tengo el siguiente codigo y me marcha bien pero solo me deja actualizar el ultimo registro ingresado los primeros no los puedo alterar no se que me faltara, aqui les dejo el codigo.
<?php require_once('Connections/informacion.php'); ?>
<?php require_once('Connections/informacion.php'); ?>
<?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;
}
}
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;
}
}
$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 personal SET Nombre_de_la_Pagina=%s, Descripcion=%s, Fecha=%s, `Direccion_Url`=%s, Hipervinculo=%s, Usuario=%s, Password=%s WHERE id=%s",
GetSQLValueString($_POST['Nombre_de_la_Pagina'], "text"),
GetSQLValueString($_POST['Descripcion'], "text"),
GetSQLValueString($_POST['Fecha'], "date"),
GetSQLValueString($_POST['Direccion_Url'], "text"),
GetSQLValueString($_POST['Hipervinculo'], "text"),
GetSQLValueString($_POST['Usuario'], "text"),
GetSQLValueString($_POST['Password'], "int"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_informacion, $informacion);
$Result1 = mysql_query($updateSQL, $informacion) or die(mysql_error());
$updateGoTo = "prueba3.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_informacion, $informacion);
$query_Recordset = "SELECT * FROM personal";
$Recordset = mysql_query($query_Recordset, $informacion) or die(mysql_error());
$row_Recordset = mysql_fetch_assoc($Recordset);
$totalRows_Recordset = mysql_num_rows($Recordset);
?><p> </p>
<p> </p>
<p align="center">
<label></label>
</p>
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<label></label>
<label></label>
<label></label>
<label></label>
<label></label>
<label></label>
<label></label>
<label></label>
<?php do { ?>
<table border="1">
<tr>
<td><input name="id" type="text" id="id" value="<?php echo $row_Recordset['id']; ?>" size="5"></td>
<td><input name="Nombre_de_la_Pagina" type="text" id="Nombre_de_la_Pagina" value="<?php echo $row_Recordset['Nombre_de_la_Pagina']; ?>"></td>
<td><input name="Descripcion" type="text" id="Descripcion" value="<?php echo $row_Recordset['Descripcion']; ?>"></td>
<td><input name="Fecha" type="text" id="Fecha" value="<?php echo $row_Recordset['Fecha']; ?>"></td>
<td><input name="Direccion_Url" type="text" id="Direccion_Url" value="<?php echo $row_Recordset['Direccion_Url']; ?>"></td>
<td><input name="Hipervinculo" type="text" id="Hipervinculo" value="<?php echo $row_Recordset['Hipervinculo']; ?>"></td>
<td><input name="Usuario" type="text" id="Usuario" value="<?php echo $row_Recordset['Usuario']; ?>"></td>
<td><input name="Password" type="text" id="Password" value="<?php echo $row_Recordset['Password']; ?>"></td>
</tr>
</table>
<?php } while ($row_Recordset = mysql_fetch_assoc($Recordset)); ?>
<p> </p>
<p align="center">
<label>
<input type="submit" name="Actualizar" id="Actualizar" value="Actualizar">
</label>
<label>
<input type="reset" name="Restablecer" id="Restablecer" value="Restablecer">
</label>
</p>
<p> </p>
<input type="hidden" name="MM_update" value="form1">
</form>
<p align="center"> </p>
<p>
<?php
mysql_free_result($Recordset);
?>