Hola a todos, necesito su ayuda por fis tengo la siguiente funcion en php
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_asignaturas = "-1";
if (isset($_GET['idgrado'])) {
$colname_asignaturas = $_GET['idgrado'];
}
mysql_select_db($database_connection, $connection);
$query_asignaturas = sprintf("SELECT * FROM asignaturas WHERE idgrado = %s ", GetSQLValueString($colname_asignaturas, "text"));
$asignaturas = mysql_query($query_asignaturas, $connection) or die(mysql_error());
$row_asignaturas = mysql_fetch_assoc($asignaturas);
$totalRows_asignaturas = mysql_num_rows($asignaturas);
me funciona perfecto, como se darán cuenta la utilizo para condicionar el idgrado (que sea = al que el usuario elija)
mi pregunta es si quiero condicionar aparte la clave de la asignatura... ya q dependiendo del grado q el usuario elija se mostraran las materias de dicho grado...
y el usuario podra elegir la materia
Código:
$colname_asignaturas = "-1";
if (isset($_GET['idgrado'])) {
$colname_asignaturas = $_GET['idgrado'];
supongo q aqui debo agregar algo jeje pero no he podido resolverlo , podrían orientarme x fa