Estoy utilizando PHP y MySQL, si alguien sabe por favor ayudeme con esto, gracias.
Adjunto el código
Código 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"] == "form2")) {
$updateSQL = sprintf("UPDATE estudiante SET nombre=%s, apellido=%s, dir_domicilio=%s, tel_domicilio=%s, dir_oficina=%s, tel_oficina=%s WHERE cod_estudiante=%s",
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['apellido'], "text"),
GetSQLValueString($_POST['dir_domicilio'], "text"),
GetSQLValueString($_POST['tel_domicilio'], "int"),
GetSQLValueString($_POST['dir_oficina'], "text"),
GetSQLValueString($_POST['tel_oficina'], "text"),
GetSQLValueString($_POST['cod_estudiante'], "int"));
mysql_select_db($database_notas, $notas);
$Result1 = mysql_query($updateSQL, $notas) or die(mysql_error());
}
$colname_Recordset2 = "-1";
if (isset($_POST['cod_estudiante'])) {
$colname_Recordset2 = $_POST['cod_estudiante'];
}
mysql_select_db($database_notas, $notas);
$query_Recordset2 = sprintf("SELECT * FROM estudiante WHERE cod_estudiante = %s", GetSQLValueString($colname_Recordset2, "int"));
$Recordset2 = mysql_query($query_Recordset2, $notas) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>