n0TTT_ Posted May 29, 2013 at 05:41 PM Report #509638 Posted May 29, 2013 at 05:41 PM Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in index.php on line 26 Linha: <?php while($row = mysql_fetch_array($sql)){ //Linha 26 $sectionID = $row["id"]; $sectionTitle = $row["title"]; $displayList .= '<br /><a href="section.php?id=' . $sectionID . '"><img src="style/sectionPic.jpg" width="61" height="23" alt="Section" /> ' . $sectionTitle . '</a><br /><hr />'; } ?>
Rui Carlos Posted May 29, 2013 at 05:58 PM Report #509639 Posted May 29, 2013 at 05:58 PM Parece-me que o problema está na variável $sql, que não mostras como é inicializada. Rui Carlos Gonçalves
n0TTT_ Posted May 29, 2013 at 06:10 PM Author Report #509640 Posted May 29, 2013 at 06:10 PM Parece-me que o problema está na variável $sql, que não mostras como é inicializada. $sql = mysql_query("10"); $displayList = ""; // Initialize the display variable here while($row = mysql_fetch_array($sql)){ $sectionID = $row["id"]; $sectionTitle = $row["title"]; $displayList .= '<br /><a href="section.php?id=' . $sectionID . '"><img src="style/sectionPic.jpg" width="61" height="23" alt="Section" /> ' . $sectionTitle . '</a><br /><hr />'; }
Rui Carlos Posted May 29, 2013 at 06:19 PM Report #509641 Posted May 29, 2013 at 06:19 PM O 10 é suposto ser uma query? O que está a acontecer é que a função mysql_query está a dar erro, e como tal devolve FALSE. Seria conveniente explicares o que estás a tentar fazer. Também não devia usar a função mysql_query, como é indicado aqui. Rui Carlos Gonçalves
n0TTT_ Posted May 29, 2013 at 06:33 PM Author Report #509646 Posted May 29, 2013 at 06:33 PM vou mandar o código todo isto original mente estáva assim : <?php session_start(); include_once "../scripts/connect_to_mysql.php"; // Connect to the database $sql = mysql_query("SELECT * FROM forum_sections ORDER BY ordered ASC LIMIT 10"); $displayList = ""; // Initialize the display variable here while($row = mysql_fetch_array($sql)){ $sectionID = $row["id"]; $sectionTitle = $row["title"]; $displayList .= '<br /><a href="section.php?id=' . $sectionID . '"><img src="style/sectionPic.jpg" width="61" height="23" alt="Section" /> ' . $sectionTitle . '</a><br /><hr />'; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="style/style.css" rel="stylesheet" type="text/css" /> <title>Web Intersect Forum</title> </head> <body> <?php include_once("template_header.php"); ?> <table style="background-color: #F0F0F0; border:#069 1px solid; border-top:none;" width="900" border="0" align="center" cellpadding="12" cellspacing="0"> <tr> <td width="731" valign="top"> <div id="breadcrumbs"><a href="http://www.webintersect.com">Web Intersect Home</a></div> <div id="sectionLinks"><ul><?php echo $displayList; ?></ul></div></td> <td width="189" valign="top"><div style=" width:160px; height:600px; background-color: #999; color: #CCC; padding:12px;"> <br /><br /><br /> <h3>Ad Space or Whatever</h3> </div></td> </tr> </table> <?php include_once("template_footer.php"); ?> </body> </html> tirei o código da net..
HappyHippyHippo Posted May 29, 2013 at 07:45 PM Report #509667 Posted May 29, 2013 at 07:45 PM nem vou comentar o quanto desactualizado esse código está altera para isto e diz qual é a mensagem de erro $sql = mysql_query("SELECT * FROM forum_sections ORDER BY ordered ASC LIMIT 10") or die(mysql_error()); IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
n0TTT_ Posted May 29, 2013 at 08:04 PM Author Report #509671 Posted May 29, 2013 at 08:04 PM Sim realmente este mod e de 2009, andei a procura e encontrei o actualizado de 2013 xD vou ver se tem erros
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now