Código PHP:
Ver original<?php require_once('Connections/clasi.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
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;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_datoscategoria = 10;
$pageNum_datoscategoria = 0;
if (isset($_GET['pageNum_datoscategoria'])) { $pageNum_datoscategoria = $_GET['pageNum_datoscategoria'];
}
$startRow_datoscategoria = $pageNum_datoscategoria * $maxRows_datoscategoria;
$varcategoria_datoscategoria = "0";
if (isset($_GET["cat"])) { $varcategoria_datoscategoria = $_GET["cat"];
}
$query_datoscategoria = sprintf("SELECT * FROM principal WHERE principal.id_categoria=%s ORDER BY principal.id DESC", GetSQLValueString
($varcategoria_datoscategoria, "int")); $query_limit_datoscategoria = sprintf("%s LIMIT %d, %d", $query_datoscategoria, $startRow_datoscategoria, $maxRows_datoscategoria);
if (isset($_GET['totalRows_datoscategoria'])) { $totalRows_datoscategoria = $_GET['totalRows_datoscategoria'];
} else {
$all_datoscategoria = mysql_query($query_datoscategoria); }
$totalPages_datoscategoria = ceil($totalRows_datoscategoria/$maxRows_datoscategoria)-1;
$varcat_consultacategoria = "0";
if (isset($_GET["recordID"])) { $varcat_consultacategoria = $_GET["recordID"];
}
$query_consultacategoria = sprintf("SELECT * FROM categorias WHERE categorias.id_categoria=%s", GetSQLValueString
($varcat_consultacategoria, "int"));
$query_subcategoria = "SELECT * FROM subcategorias ORDER BY subcategorias.nombre_subcategoria ASC ";
$queryString_datoscategoria = "";
if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); foreach ($params as $param) {
if (stristr($param, "pageNum_datoscategoria") == false && stristr($param, "totalRows_datoscategoria") == false) { }
}
if (count($newParams) != 0) { }
}
$queryString_datoscategoria = sprintf("&totalRows_datoscategoria=%d%s", $totalRows_datoscategoria, $queryString_datoscategoria); ?>
Esto es lo que llevo en las categorias de aqui quiero crear una consulta para las sub categorias pero nose como hacer