1 ضمیمه
خطای ()Warning: mysqli_fetch_assoc
با سلام خدمت تمام دوستان گرامی
نزدیک به یک هفته است دارم با مشکل
Warning: mysqli_fetch_assoc expects parameter 1 to be mysqli_result, boolean given in /home/leavesmo/public_html/admin/action/membership-answer.php on line 191
دست و پنجه نرم می کنم .
و هنوز به جایی نرسیدم.
فایل پیوست شده.
لطفاً بنده را راهنمایی کنید.
نقل قول: خطای ()Warning: mysqli_fetch_assoc
خب کد رو هم بزار ببینیم مشکل کجاست
نقل قول: خطای ()Warning: mysqli_fetch_assoc
نقل قول:
نوشته شده توسط
phpjoker
با سلام خدمت تمام دوستان گرامی
نزدیک به یک هفته است دارم با مشکل
Warning: mysqli_fetch_assoc expects parameter 1 to be mysqli_result, boolean given in /home/leavesmo/public_html/admin/action/membership-answer.php on line 191
دست و پنجه نرم می کنم .
و هنوز به جایی نرسیدم.
فایل پیوست شده.
لطفاً بنده را راهنمایی کنید.
خیلی واضح داره میگه پارامتری که به تابع میدین اشتباهه.
پس مشکل در کوئریتونه
نقل قول: خطای ()Warning: mysqli_fetch_assoc
با سلامی دوباره ...
اینم از کد . یعنی همون قسمتی که ارور میده :
<?phprequire("db.php");global $connect;mysqli_query($connect , "SET NAMES utf8");$id = $_GET['id'];$string = "SELECT * FROM membership WHERE id=$id";$query = mysqli_query($connect , $string);
$array_id = mysqli_fetch_assoc($query);
$subject = " وب سایت ترک سیگار مدیاتور ";
// SEND EMAIL
if($_SERVER["REQUEST_METHOD"] == "POST"){ $subject = $_POST['text_name']; $to = $_POST['email_name'] ; $message = $_POST['content'] ; $from = "mediator@leavesmoke.com"; $headers = "From:" . $from;
if(mail($to , $subject , $message,$headers)){ //echo "SENT"; $sent = "SENT"; echo '<div id="send">'.$sent.'</div>'; }else{ //echo "ERROR"; $error = "ERROR"; echo '<div id="error">'.$error.'</div>'; }}
;?>
نقل قول: خطای ()Warning: mysqli_fetch_assoc
نقل قول:
نوشته شده توسط
phpjoker
با سلامی دوباره ...
اینم از کد . یعنی همون قسمتی که ارور میده :
<?phprequire("db.php");global $connect;mysqli_query($connect , "SET NAMES utf8");$id = $_GET['id'];$string = "SELECT * FROM membership WHERE id=$id";$query = mysqli_query($connect , $string);
$array_id = mysqli_fetch_assoc($query);
$subject = " وب سایت ترک سیگار مدیاتور ";
// SEND EMAIL
if($_SERVER["REQUEST_METHOD"] == "POST"){ $subject = $_POST['text_name']; $to = $_POST['email_name'] ; $message = $_POST['content'] ; $from = "mediator@leavesmoke.com"; $headers = "From:" . $from;
if(mail($to , $subject , $message,$headers)){ //echo "SENT"; $sent = "SENT"; echo '<div id="send">'.$sent.'</div>'; }else{ //echo "ERROR"; $error = "ERROR"; echo '<div id="error">'.$error.'</div>'; }}
;?>
بعد هر خط به var_dump($variable_name) بگیر ببین توی هر خط خروجی چیه
من با کد شما تست گرفتم و با کد زیر از دیتابیسم کوئری گرفتم و جواب داد
http://www.pic98.ir/upload/0g9_234234234.jpg
شما میخوای توی پی وی کد این صفحه تون رو برام بفرستید کامل چک کنم
require("inc/test_db.php");
global $connect;
mysqli_query($connect , "SET NAMES utf8");
if(isset($_GET['btnsub']))
{
$id = $_GET['id'];
var_dump($id); echo "<hr>";
$string = "SELECT * FROM customers WHERE customer_id=$id";
var_dump($string); echo "<hr>";
$query = mysqli_query($connect , $string);
var_dump($query); echo "<hr>";
$array_id = mysqli_fetch_array($query);
var_dump($array_id);
echo "<hr>";
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
</head>
<body>
<form action="test.php" method="get">
<input type="text" name="id">
<input type="submit" name="btnsub">
</form> </body>
</html>
نقل قول: خطای ()Warning: mysqli_fetch_assoc
کوئریت موفق نیست و false برمیگردونه شما بدون توجه به این موضوع توی تابع میزاری که اررور تولید میکنه
https://barnamenevis.org/showthread.p...%B1-INNER-JOIN
3 ضمیمه
نقل قول: خطای ()Warning: mysqli_fetch_assoc
انجام دادم .
و ارور زیر را به من داد.
واقعاً هنگ کردم . همه چی درسته ولی نمی دونم چرا اینطوری شده.
نقل قول: خطای ()Warning: mysqli_fetch_assoc
تو عکس اول id به صفحه ارسال نشده توی لینک
ولی شما بدون چک کردن این مسئله داری id میزاری تو کوئری که باعث تولید اررور میشه
لینک های توی عکس رو نگاه کن متوجه تفاوتشون میشی
نقل قول: خطای ()Warning: mysqli_fetch_assoc
یعنی اشکال تو همین صفحه اس یا باید برم توی صفحات دیگه.؟
من که هر چی کد رو نگاه می کنم چیزی پیدا نمی کنم.
نقل قول: خطای ()Warning: mysqli_fetch_assoc
اینجوری بنویس
$id = isset($_GET['id']) ? $_GET['id'] : 0 ;
نقل قول: خطای ()Warning: mysqli_fetch_assoc
تشکر از اینکه برای بنده وقت صرف میکنید.:لبخندساده:
سوال بنده رو متوجه نشدید .
من میگم تو همین صفحه فقط مشکل هست یا مشکل از صفحات قبل تره؟
هر کاری بگید کردم نشد که نشد.