Jump to content

Erro(Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in index.php on line 26)


n0TTT_

Recommended Posts

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 />';
}
?>
Link to comment
Share on other sites

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 />';
}
Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.