Hi, im trying to display some data in a table (php + mysql)
this is the code to create the table
function hacer_lista_materia()
{
include("opcion.php"); //this just have $numfilas = 10
$page=$_GET["pag"];
if (($page=="") or ($page==1))
{ $offset=0; }
else
{ $offset=($page-1)*$numfilas;}
[B]$result_count=mysql_query("SELECT count(*) as total FROM materia", $conexion);[/B]
[B]while ($count=mysql_fetch_array($result_count, MYSQL_ASSOC))[/B]
{$total= ceil($count["total"]/$numfilas);}
[B]$result=mysql_query("select codmateria, nommateria from materia order by nommateria LIMIT '$numfilas' OFFSET '$offset';", $conexion) or die('Consulta fallida');[/B]
echo ("<blockquote><table border \"1\">\n");
echo ('<font face="Geneva, Arial, Helvetica, sans-serif" size="1">');
echo ('<tr><td><div align="center"><b>Materia</td><td><div align="center"><b>Modificar</td><td><div align="center"><b>Eliminar</td></tr>');
while ($row=mysql_fetch_array($result, MYSQL_ASSOC))
{
echo '<tr><td><div align="left">'.$row["nommateria"].'</td>';
echo '<td><div align="center"><a href="mant_materia_mod.php?codmateria='.$row["codmateria"].'"><img src="../images/edit.gif" width="15" height="15" border="0" alt="Modificar"></a></td>';
echo '<td><div align="center"><a href="mant_materia_del.php?codmateria='.$row["codmateria"].'"><img src="../images/delete.gif" width="15" height="15" border="0" alt="Eliminar"></a></td></tr>';
};
echo ("</table></blockquote>");
If ($total>1)
{
echo("<center><font face='Geneva, Arial, Helvetica, sans-serif' size='2'>");
echo("Pág: <a href='mant_materia.php?pag=1'>1</a>");
for ($i = 2; $i <= $total; $i++)
{
if ($page==$i)
echo (" - $i");
else
echo (" - <a href='mant_frase.php?pag=$i'>$i</a>");
}
echo("</center>");
}
mysql_close($conexion);
}
i have errors in those lines in bold:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\web\SGC\funciones.php on line 12
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\web\SGC\funciones.php on line 14
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\web\SGC\funciones.php on line 17
Consulta fallida
the idea is having something like this:

i dont know whats wronge in those lines, i used som similar code to connect to DB to login to a system, using sentences like $row=mysql_fetch_array($result, MYSQL_ASSOC) above..
any help please?
thanks