Cita:
Iniciado por pacmanaman
while($fila = mysql_fecth_array($results))
{
echo $fila['cat_id']."-". $fila['Total'];
}
SaluDOS!
Hola pacmanaman, gracias por contestar.
![de acuerdo](http://static.forosdelweb.com/fdwtheme/images/smilies/dedosarriba.png)
Lo he intentado asi:
Código PHP:
$sql="SELECT c.cat_id, COUNT( cp.cat_id ) AS total
FROM tbl_product AS c
LEFT JOIN tbl_category AS cp ON cp.cat_id = c.cat_id
GROUP BY c.cat_id";
while($fila = mysql_fecth_array($results))
{
echo $fila['cat_id']."-". $fila['Total'];
}
pero me da -> Fatal error: Call to undefined function mysql_fecth_array() in C:\wamp\www\include\categoryList.php on line 27
Aqui dejo todo el categorylist, puede que el error venga de atras
Código PHP:
<?php
if (!defined('WEB_ROOT')) {
exit;
}
$categoryList = getCategoryList();
$categoriesPerRow = 6;
$numCategory = count($categoryList);
$columnWidth = (int)(100 / $categoriesPerRow);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="20">
<?php
if ($numCategory > 0) {
$i = 0;
for ($i; $i < $numCategory; $i++) {
if ($i % $categoriesPerRow == 0) {
echo '<tr>';
}
// Tenemos la $url, $image, $name, $price
extract ($categoryList[$i]);
$sql="SELECT c.cat_id, COUNT( cp.cat_id ) AS total
FROM tbl_product AS c
LEFT JOIN tbl_category AS cp ON cp.cat_id = c.cat_id
GROUP BY c.cat_id";
while($fila = mysql_fecth_array($results))
{
echo $fila['cat_id']."-". $fila['Total'];
}
echo "<td width=\"$columnWidth%\" align=\"center\"style=vertical-align:baseline><a href=\"$url\"><img src=\"$image\" border=\"0\"><br>$name<br></a>()</td>\r\n";
if ($i % $categoriesPerRow == $categoriesPerRow - 1) {
echo '</tr>';
}
}
if ($i % $categoriesPerRow > 0) {
echo '<td colspan="' . ($categoriesPerRow - ($i % $categoriesPerRow)) . '"> </td>';
}
} else {
?>
<tr><td width="100%" align="center" valign="center">Aucune</td></tr>
<?php
}
?>
</table>