1
PHP / AYUDA - Funcion no imprime datos
« en: 25 de Marzo de 2008, 15:25:56 pm »
Saludos debo hacer esto
se trata de una ficha de productos donde deben aparecerme los productos de la siguient manera
Categoria de los productos
Subcategoria
Linea de prod.
Producto1
Producto2
y tods los mencionados en esa rama....
Ahora bien... Relaciono en la tabla Subcategoria el id_cat con el id de la tabla categoria
Relaciono en la tabla Linea id_sub con el id de la tabla subcategoria
y asi deberia de hacer con productos donde el id_lin deba ser = al id de la tabla linea..
pero la declaracion de linea no me imprime hace esto
deberia imprimir asi
Categoria
SubCategoria
Linea
y solo imprime
Categoria
SubCategoria
en les dejo mi codigo
<?php require_once('Connections/flamuko.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;
}
}
mysql_select_db($database_flamuko, $flamuko);
$query_Recordset1 = "SELECT * FROM categoria";
$Recordset1 = mysql_query($query_Recordset1, $flamuko) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<link href="css/estilos.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a {
}
a:link {
}
a:visited {
}
a:hover {
}
a:active {
}
body {
}
-->
</style>
<p class="tituloPROD"> </p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td scope="col"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5%"> </td>
<td colspan="2" class="tituloPROD"><?php
</tr>
<?php mysql_select_db($database_flamuko, $flamuko);
<td> </td>
<td width="8%"> </td>
<td width="87%" colspan="2" class="descPROD">
</tr>
<?php mysql_select_db($database_flamuko, $flamuko);
</table>
</td>
</tr>
<tr>
<td scope="col"> </td>
</tr>
</table>
<p class="tituloQUIENES">
<?php
mysql_free_result($Recordset1);
?>
se trata de una ficha de productos donde deben aparecerme los productos de la siguient manera
Categoria de los productos
Subcategoria
Linea de prod.
Producto1
Producto2
y tods los mencionados en esa rama....
Ahora bien... Relaciono en la tabla Subcategoria el id_cat con el id de la tabla categoria
Relaciono en la tabla Linea id_sub con el id de la tabla subcategoria
y asi deberia de hacer con productos donde el id_lin deba ser = al id de la tabla linea..
pero la declaracion de linea no me imprime hace esto
deberia imprimir asi
Categoria
SubCategoria
Linea
y solo imprime
Categoria
SubCategoria
en les dejo mi codigo
<?php require_once('Connections/flamuko.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;
}
}
mysql_select_db($database_flamuko, $flamuko);
$query_Recordset1 = "SELECT * FROM categoria";
$Recordset1 = mysql_query($query_Recordset1, $flamuko) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<link href="css/estilos.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a {
font-family: Verdana, Arial, Helvetica, sans-serif;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
body {
margin-left: 12px;
}
-->
</style>
<p class="tituloPROD"> </p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td scope="col"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5%"> </td>
<td colspan="2" class="tituloPROD"><?php
echo $row_Recordset1['nombre']; ?> </td>
</tr>
<?php mysql_select_db($database_flamuko, $flamuko);
$query_Recordset2 = "SELECT * FROM subcategoria WHERE id_cat =".$row_Recordset1['id'];
$Recordset2 = mysql_query($query_Recordset2, $flamuko) or die(mysql_error());
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
while($prod=mysql_fetch_assoc($Recordset2)){?>
<tr>
<td> </td>
<td width="8%"> </td>
<td width="87%" colspan="2" class="descPROD">
<?php echo $prod['nombre']; }?></td>
</tr>
<?php mysql_select_db($database_flamuko, $flamuko);
$query_Recordset3 = "SELECT * FROM linea WHERE id_sub = '$row_Recordset2[id]'";
$Recordset3 = mysql_query($query_Recordset3, $flamuko) or die(mysql_error());
$totalRows_Recordset3 = mysql_num_rows($Recordset3);
while($sub=mysql_fetch_array($Recordset3)){?>
<tr>
<td> </td>
<td> </td>
<td colspan="2" class="descPROD"><?php echo $sub[nombre]; }?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td scope="col"> </td>
</tr>
</table>
<p class="tituloQUIENES">
<?php
mysql_free_result($Recordset1);
?>



