Quiero crear una tabla dinamica con dos columnas, donde desplego el nombre y apellido de unos usuarios. Esto esta dentro de una pagina (dashboard.php) donde se accedio a traves de un formulario de ingreso (index.php).
Codigo del Index:
Código PHP:
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['user_tutor'])) {
$loginUsername=$_POST['user_tutor'];
$password=$_POST['pass_tutor'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "dashboard.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conexion, $conexion);
$LoginRS__query=sprintf("SELECT RUT_TUTOR, PASS_TUTOR FROM tutor WHERE RUT_TUTOR=%s AND PASS_TUTOR=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $conexion) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
Código 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;
}
}
$colname_rsTutoradosxTutor = "-1";
if (isset($_SESSION['RUT_TUTOR'])) {
$colname_rsTutoradosxTutor = $_SESSION['RUT_TUTOR'];
}
mysql_select_db($database_conexion, $conexion);
$query_rsTutoradosxTutor = sprintf("SELECT NOMBRE_TUTORADO, APELLIDOP_TUTORADO FROM tutorado WHERE RUT_TUTOR = %s ORDER BY RUT_TUTORADO ASC", GetSQLValueString($colname_rsTutoradosxTutor, "text"));
$rsTutoradosxTutor = mysql_query($query_rsTutoradosxTutor, $conexion) or die(mysql_error());
$row_rsTutoradosxTutor = mysql_fetch_assoc($rsTutoradosxTutor);
$totalRows_rsTutoradosxTutor = mysql_num_rows($rsTutoradosxTutor);
Primero he creado un juego de registros con NOMBRE y APELLIDO donde estos en esten asociados al RUT que ingrese en el formulario de la pagina de ingreso (index.php).
Luego creo la tabla dinamica, pero no me muestra ninguna registro.
Al parecer el problema es tipo de filtro que estoy aplicando..., he probado con variable de sesion, de formulario, etc...
Cual es el correcto nombre de la variable que debo colocar?, debo ocupar variable de sesión o variable de formulario?.
Su ayuda se agradece!.