chris_rulez001 Posted June 26, 2007 Share Posted June 26, 2007 hi im getting an error, here it is: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /www/1111mb.com/c/h/r/chrisrulez/htdocs/forumtests/index.php on line 81 my code: <?php session_start() ?> <!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=iso-8859-1" /> <title> - Home</title> <link rel="stylesheet" href="css/stylesheet.css" /> </head> <body text="000000" bgcolor="F1F1F1" link="003399" vlink="003399" alink="003399"> <?php $host="localhost"; // Host name $username="chrisrulez_admin"; // Mysql username $password="buzzer2242"; // Mysql password $db_name="chrisrulez_cforum"; // Database name $tbl_name="boards"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT FROM $tbl_name ORDER BY id DESC"; // OREDER BY id DESC is order result by descending $result=mysql_query($sql); ?> <br /> <table width="92%" cellspacing="1" cellpadding="0" border="0" align="center" bgcolor="000000" class="bordercolor"> <tr> <td width="100%"> <table border="0" width="100%" cellpadding="0" cellspacing="0"> <tr> <td width="27%" height="50" align="center" bgcolor="F1F1F1" class="welcomebg"> </td> <td width="73%" bgcolor="F1F1F1" class="welcomebg" align="center"> <p><font size="2"> <?php if (!isset($_SESSION['username']) == false) echo "Welcome, ".$_SESSION['displayname'].""; else{ echo "Welcome, Guest, Please <a href='login.php'>Login</a> or <a href='register.php'>Register</a>"; }?><br/> <?php $date = date("l F d, g i a"); echo $date; ?> </font><br /></p> </td> </tr> </table> </td> </tr><tr> <td align="center"> <table width="100%" cellspacing="0" cellpadding="0" align="center"> <tr> <td width="100%" align="center"> <table border="0" width="100%" cellpadding="3" cellspacing="0" align="center"> <tr> <td class="menubg" valign="middle" bgcolor="EFEFEF" align="center"><font size="1"> <a href="/index.php">[Home]</a> <a href="/help.php">[Help]</a> <a href="/members.php">[Members]</a> <a href="/profile.php">[Profile]</a> <?php if (!isset($_SESSION['username']) == false) echo "<a href='logout.php'>[Logout]</a>"; else{ echo "<a href='login.php'>[Login]</a> <a href='register.php'>[Register]</a>"; }?> </font></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <br /> <center></center><br /> <br /> <table width="92%" cellspacing="0" cellpadding="0" align="center"> <tr> <td valign="top" width="100%"> <br /> <a href="/index.cgi" class="nav"></a> :: Home<br/> <?php while($rows = mysql_fetch_array($result)){ // Start looping table row ?> <table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="000000" class="bordercolor"> <tr> <td> <table cellpadding="4" cellspacing="1" border="0" width="100%"> <tr> <td class="titlebg" bgcolor="4080B0" colspan="2"> <font class="titletext" color="F1F1F1" size="-1"><b>Forum Name</b></font> </td> <td class="titlebg" bgcolor="4080B0" width="1%" align="center"> <font class="titletext" color="F1F1F1" size="-1"><b>Topics</b></font> </td> <td class="titlebg" bgcolor="4080B0" width="1%" align="center"> <font class="titletext" color="F1F1F1" size="-1"><b>Posts</b></font> </td> <td class="titlebg" bgcolor="4080B0" width="24%" align="center"> <font class="titletext" color="F1F1F1" size="-1"><b>Last Post</b></font> </td> </tr> <tr> <td colspan="5" class="catbg" bgcolor="DADADA" height="18"> <font size="2" class="cattext" color="0E0E0E"><b><?php echo $rows['catogory']; ?></b></font> </td> </tr> <tr> <td class="windowbg" bgcolor="EFEFEF" width="8%" align="center" valign="middle"> <img src="http://s2.images.proboards.com/on.gif" alt="[*]" border="0"/> </td> <td class="windowbg2" bgcolor="F6F6F6" align="left" width="66%" valign="top" style="cursor:pointer;" onClick="if(!pb_bubble)location.href='/index.cgi?board=updates';" onMouseOver="mouseOverHighlightCell(this);setWindowStatus('Upgrades / News Board');return true;" onmouseout="mouseOutHighlightCell(this);setWindowStatus('');return true;"> <font size="2"><a href="view_board.php?board=<?php echo $rows['board']; ?>"><?php echo $rows['boardname']; ?></a></font><br/> <font size="1"><?php $rows['description']; ?><br/></font> </td> <td class="windowbg" bgcolor="EFEFEF" valign="middle" align="center" width="1%"> <font size="2"><? echo $rows['topics']; ?></font> </td> <td class="windowbg" bgcolor="EFEFEF" valign="middle" align="center" width="1%"> <font size="2"><? echo $rows['posts']; ?></font> </td> <td class="windowbg2" bgcolor="F6F6F6" width="24%" valign="top"> <font size="1"></font> </td> </tr> <tr> <td colspan="5" class="catbg" bgcolor="DADADA" height="18"> <font size="2" class="cattext" color="0E0E0E"><b><?php echo $rows['catogory']; ?></b></font> </td> </tr> <tr> <td colspan="5" align="right" class="catbg" bgcolor="DADADA" height="18"><font size="2" class="cattext" color="0E0E0E">Mark All Boards As Read <a href="/index.cgi?action=markallboardsread"></a></font> </td> </tr> </table> </td> </tr> </table> <br/><br/> <table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="000000" class="bordercolor"> <tr> <td> <table cellpadding="4" cellspacing="1" border="0" width="100%"> <tr> <td bgcolor="4080B0" class="titlebg" align="center" colspan="2"> <font class="text1" color="F1F1F1" size="2"><b>Info Center</b></font> </td> </tr> <tr> <td class="catbg" bgcolor="DADADA" colspan="2"> <font size="2" class="cattext" color="0E0E0E"><b>Forum Statistics</b></font> </td> </tr> <tr> <td class="windowbg2" bgcolor="F6F6F6" valign="top" align="center"> <table width="98%" cellpadding="3" align="center"><tr><td valign="top" align="left" width="60%"> <font size="1">Total Topics: - Total Posts: <br/> Last Updated Topic: by <br/>View the <a href="/index.cgi?action=recent">10 most recent posts</a> of this forum.</font> </td> <td valign="top" align="left" width="40%"> <font size="1">Total Members: <a href="/index.cgi?action=members">107,014</a><br/>Newest Member: <a href="/index.cgi?action=viewprofile&user=contagiouslaughter">Azar</a><br/>Your Private Messages: <a href="/index.cgi?action=pm">115</a> New: <a href="/index.cgi?action=pm">0</a></font> </td> </tr> </table> </td> </tr> <tr> <td class="catbg" bgcolor="DADADA" colspan="2"> <font size="2" class="cattext" color="0E0E0E"><b>Today's Birthdays</b></font> </td> </tr> <tr> <td class="windowbg2" bgcolor="F6F6F6" valign="top"> <table width="98%" cellpadding="3" align="center"> <tr> <td valign="top" align="left"> <font size="1"> birthdays today.<br/></font> </td> </tr> </table> </td> </tr> <tr> <td class="catbg" bgcolor="DADADA" colspan="2"> <font size="2" class="cattext" color="0E0E0E"><b>Users Online</b></font> </td> </tr> <tr> <td class="windowbg2" bgcolor="F6F6F6"><table width="98%" cellpadding="3" align="center"> <tr> <td valign="top" align="left"><font size="1">3 Staff Members, 65 Members, 78 Guests, 7 Invisible Users. Most users online was 368, 29 Jul, 2006, 9:32pm<br/> </font></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <?php // Exit looping and close connection } mysql_close(); ?> <center></center> </body> </html> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 26, 2007 Share Posted June 26, 2007 try this repalce: $sql="SELECT FROM $tbl_name ORDER BY id DESC"; with $sql="SELECT * FROM $tbl_name ORDER BY id DESC"; Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted June 26, 2007 Author Share Posted June 26, 2007 thanks it works now Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 26, 2007 Share Posted June 26, 2007 mark your topic as solved please Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.