مشکل در ارتباط یک فایل پی اچ

Elfin-D

Member
سلام
این کد رو ببینید:

PHP:
<?php 
print '<html dir="rtl"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>body { font-family: Tahoma ;font-size: 8pt; color : #000000;}
.a { color : #000066 ;}
a:link{	text-decoration: none;}
a:visited{	text-decoration: none;}
a:hover, a:active{	text-decoration: underline;}
.item { font-family: Tahoma ;font-size: 8pt; color : #003399;}
</style>
';

// Forum Information And Database Settings
$db_host = "localhost";
$db_name = "local"; 
$db_user = "root"; 
$db_pw = ""; 
$forum_url = "http://localhost/vb"; 


if (empty($_GET['p'])) {
$limit = "10";

} else {
$limit=$_GET['p'];
 }
 if ($limit) {
	$limited = "LIMIT $limit";
}
 
$txtlimit = "150";



mysql_connect($db_host, $db_user, $db_pw) 
OR die ("Cannot connect to your database"); 
mysql_select_db($db_name) OR die("Cannot connect to your database"); 


echo"<marquee onmouseover=this.stop() onmouseout=this.start() dir=\"rtl\" direction=\"up\" scrollAmount=\"1\" scrolldelay=\"1\" height=\"120\">";
echo "<table dir=\"rtl\" border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">";

$thread_sql = mysql_query("SELECT threadid,title,lastpost,lastposter,replycount,views FROM thread WHERE visible=1 AND open=1 ORDER BY lastpost DESC $limited");

while($thread_get = mysql_fetch_array($thread_sql))
{
$replycount = $thread_get['replycount'];
$views = $thread_get['views'];
$lastpost = $thread_get['lastpost'];
$poster = $thread_get['lastposter'];
$tid = $thread_get['threadid'];
$psql = mysql_query("SELECT postid FROM post WHERE threadid=$tid ORDER BY postid DESC");
$getp = mysql_fetch_array($psql);
$pid = $getp['postid'];
$date2 = date ("m/d/y h:i A" ,$lastpost);
$title = $thread_get['title'];
$title = substr($title,0,$txtlimit);
echo "<font style =\"title\"><table border=\"0\" width=\"100%\" id=\"table1\" cellspacing=\"0\" cellpadding=\"0\"><tr>	<td width=\"450\"><a target=_blank href=\"$forum_url/showthread.php?t=$tid&p=$pid\">\n";
echo "	<span style=\"font-size: 8pt; text-decoration:none\"><font color=\"#000066\">$title</font></span></a></td>	</font>\n";
echo "	<td width=\"51\"><span style=\"font-size: 8pt\"><font face=\"Tahoma\">نويسنده&nbsp; 	:</span></td>	\n";
echo "	<td width=\"150\" align=\"center\">\n";
echo "	<font face=\"Tahoma\" style=\"font-size: 8pt\" color=\"#003399\"><a target=\"_blank\" href=\"$forum_url/member.php?username=$poster\"><span style=\"font-size: 8pt; text-decoration:none\"><font color=\"#000066\">$poster</font></span></a></td>		\n";
echo "	<td width=\"72\"><font face=\"Tahoma\" style=\"font-size: 8pt\">| مشاهده ها :</td>		\n";
echo "	<td width=\"25\" align=\"center\"><center>	\n";
echo "	<font face=\"Tahoma\" style=\"font-size: 8pt\" color=\"#003399\">$views </center></td><td width=\"59\">	<font face=\"Tahoma\" style=\"font-size: 8pt\">| پاسخ ها :</td>	<td>	\n";
echo "	<span class=\"item\">$replycount</span></td></tr></table></td></tr>";
}
echo "</table>";
echo"</marquee>";

?>
این فایل last.phpهست که برای ویبولتین نوشته شده
وقتی این رو روی لوکال اجرا میکنم ارور زیر رو میده
به نظر شما مشکل از کجاس؟!!
مرسی
ارور مورد نظر:
کد:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\program files\easyphp1-7\www\vb\last.php on line 44
 

Ocarina

Member
قبل از هر
کد:
mysql_fetch_array($result);
یک
کد:
if($result)
بزار

این اشکال زمانی اتفاق میفته که هیچ رکوردی از بانک استنتاج نشده باشه!
 

جدیدترین ارسال ها

بالا