PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : ارور mysql_fetch_assoc()



espad
May 29th, 2014, 20:29
سلام دوستان
کسی میدونه ارور زیر مربوط به چیه ؟
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\wamp\www\New folder\menughaza.php on line 47

<!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" />
<title>برنامه جامع رستوران</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body {
background-color: #CFC;
}
</style>
</head>
<body>
<div class="container">
<?php require "header.php" ?>
<?php
require("menu.php");
?>
<div id="rbody">
<table>
<thead>
<tr>
<th>نام موسسه</th>
<th>نوع فعاليت</th>
<th>نام مدير مسئول</th>
<th>تلفن</th>
<th>آدرس</th>
<th colspan="2">عمليات</th>
</tr>
</thead>
<tbody>
<?php
if (isset($_GET['action']))
{
$action = addslashes($_GET['action']);
$id = intval($_GET['id']);
if ($action == 'del')
{
$sql = "DELETE FROM `etehadie` WHERE `id` = $id";
mysql_query($sql);
}
}

$sql = "SELECT * FROM `etehadie`";
$res = mysql_query($sql);
$c = 1;
while ($row = mysql_fetch_assoc($res))
{
if ($c)
echo '<tr class="tr_odd">';
else
echo '<tr class="tr_even">';

echo '<td>'.$row['title'].'</td>';
echo '<td>'.$row['activity'].'</td>';
echo '<td>'.$row['manager'].'</td>';
echo '<td>'.$row['phone'].'</td>';
echo '<td>'.nl2br($row['address']).'</td>';
echo '<td><a href="info.php?action=edit&id='.$row['id'].'">ويرايش</a></td>';
echo '<td><a href="?action=del&id='.$row['id'].'">حذف</a></td>';
echo '</tr>';
$c=!$c;
}
echo "<tr><td colspan=7><a href='info.php?action=new'>افزودن موسسه</a></td></tr>"
?>
</tr>
</table>
</div>
</div>
</body>
</html>


ممنون

royl
May 29th, 2014, 21:23
تابع mysql_fetch_assoc() در سرور فعال نیست

espad
May 29th, 2014, 22:19
تابع mysql_fetch_assoc() در سرور فعال نیست

فکر نمی کنم مشکل از این باشه چون همین کد تو ی برنامه دیگه کار میکنه

Bit-O-Byte
May 31st, 2014, 00:56
کانکشن به mysql کجاست؟

بعد از این خظ متغیر $res را چاپ کنید، احتمالن برابر با false هست


$res = mysql_query($sql);

shahinmq
May 31st, 2014, 01:06
این کد هم یه تست بزن :



mysql_fetch_array($result, $result_type);


به عنوان مثال :



while ($row = mysql_fetch_array($result, MYSQL_ASSOC))


امیدوارم به دردت خورده باشه