So'rov to'g'ri tartiblangan, lekin barcha natijalarni to'g'ri ko'rsatmaydi

Quyidagi so'rovlar ishlaydi, lekin men g'alati xatolarga duch kelaman. Foydalanuvchilar jadvalidagi birinchi foydalanuvchi barcha boshqa foydalanuvchilar tomonidan ular bilan bog'liq barcha yordam savollariga ega bo'lishlari mumkin. Ma'lumotlar bazasidagi ikkinchi foydalanuvchi esa faqatgina birinchi masala bo'yicha o'z yordamchilari savollariga javob berishi mumkin va so'rovlar o'sha ikkinchi shaxs uchun o'sha jadvaldagi boshqa odamlarning natijalarini e'tiborsiz qoldiradi.

Menimcha, bu parantez bilan bog'liqmi?

Kod:

//Unseen
$variis = "Need Help";
$myid = "This is the user's id;"

$sql = "select car_help.car_id, agent_names.agent_name, help_box.status, 
car_help.why_car, car_help.date_time_added, car_help.just_date, 
car_help.type, agent_names.agent_id
from car_help LEFT JOIN agent_names on car_help.agent_whois = agent_names.agent_id 
where agent_names.system_id = '$myid' and car_help.system_id='$myid' 
and added_by <> '$myid' and help_box.status = '$variis'
UNION
select magazine_help.note_id, agent_names.agent_name, help_box.status, 
magazine_help.note_name, magazine_help.date_time_added, 
magazine_help.just_date, magazine_help.type, agent_names.agent_id
from magazine_help LEFT JOIN agent_names on 
magazine_help.agent_id = agent_names.agent_id 
where agent_names.system_id='$myid' and 
magazine_help.system_id = '$myid' and added_by <> '$myid' 
and help_box.status = '$variis'
UNION
select motorcycle_help.rand_id, agent_names.agent_name, 
help_box.status, motorcycle_help.rand_name, motorcycle_help.date_time_added,     
motorcycle_help.just_date, motorcycle_help.type, agent_names.agent_id
from motorcycle_help LEFT JOIN agent_names ON 
motorcycle_help.by_who = agent_names.agent_id
where agent_names.system_id = '$myid' and 
motorcycle_help.system_id='$myid' and added_by <> '$myid' 
and help_box.status = '$variis'
UNION
select mobile_questions.bal_test_id, agent_names.agent_name, 
help_box.status, mobile_questions.bal_why, mobile_questions.date_time_added,   
mobile_questions.just_date, mobile_questions.type, agent_names.agent_id
from mobile_questions LEFT JOIN agent_names ON 
mobile_questions.agent_who_ordered = agent_names.agent_id
where agent_names.system_id = '$myid' and 
mobile_questions.system_id='$myid' and added_by <> '$myid' 
and help_box.status = '$variis'
ORDER BY date_time_added DESC LIMIT $startrow, 20";

$result = mysql_query($sql);

$query = mysql_query($sql) or die ("Error: ".mysql_error());


if ($result == "")
{
echo "";
}
echo "";


$rows = mysql_num_rows($result);

if($rows == 0)
{
print("");

}
elseif($rows > 0)
{
while($row = mysql_fetch_array($query))
{

$row1 = $row['row_name'];


print("$row1");
}

}
1

1 javoblar

where agent_names.system_id = '$myid' and 
motorcycle_help.system_id='$myid' and added_by <> '$myid' 
and help_box.status = '$variis'

faqatgina true bo'lsa, ma'lumotlarni qayta kiriting. agar ikkinchi shaxsning uchta sohada mos keladigan identifikatori bo'lmasa, siz kutgan narsangizni qaytarib bermaydi. $ variis bo'sh bo'lsa, qo'ng'iroq o'zgaruvchining o'rniga o'tadigan standart identifikatorni yarating. a yoki tushuntirish kerak bo'lishi mumkin. va agar siz echo tayoqni ishlatmoqchi bo'lsangiz, bosma xuddi shu narsani qiladi.

1
qo'shib qo'ydi
aslida u ishlagan. Men har bir so'rovdan agent_names.system_id = '$ myid' ni qaerdan olib tashladim. Javobingizni tanlab olishingiz, chunki siz hech bo'lmaganda javob berishga harakat qildingiz. rahmat.
qo'shib qo'ydi muallif AAA, manba
PhP |BotsUz
PhP |BotsUz
93 ishtirokchilar

Phpni o'rganishni Hohlasangiz https://t.me/joinchat/AAAAAE-KRc5dd5tPMmGmWA A'zo bo'lin