السلام عليكم
عملت الاستعلام التالي :
ولله الحمد نجحكود:$query0 = "SELECT pagetext,postid,dateline,iconid FROM post WHERE threadid='$thread[threadid]' ORDER BY dateline LIMIT 1"; $lastpost = mysql_query($query0) or die("MySQL reported this error while trying to retrieve the last post info: ".mysql_error()); while ($lastpost1 = mysql_fetch_array($lastpost)) { $lastpostshort = $lastpost1[pagetext]; $lastpostshort = nl2br($lastpostshort); $lastpostshort = str_replace("","<i>",$lastpostshort); $lastpostshort = str_replace("","</i>",$lastpostshort); $lastpostshort = str_replace("","<u>",$lastpostshort); $lastpostshort = str_replace("","</u>",$lastpostshort); $lastpostshort = str_replace("","<b>",$lastpostshort); $lastpostshort = str_replace("","</b>",$lastpostshort); $lastpostshort = str_replace("","<i>",$lastpostshort); $lastpostshort = str_replace("","</i>",$lastpostshort); $lastpostshort = str_replace("","<u>",$lastpostshort); $lastpostshort = str_replace("","</u>",$lastpostshort); $lastpostshort = str_replace("","<b>",$lastpostshort); $lastpostshort = str_replace("","</b>",$lastpostshort); $lastpostshort = str_replace("[img]","<img border=\"0\" src=\"",$lastpostshort); $lastpostshort = str_replace("[/img]","\">",$lastpostshort); $lastpostshort = str_replace("[IMG]","<img border=\"0\" src=\"",$lastpostshort); $lastpostshort = str_replace("[/IMG]","\">",$lastpostshort); $lastpostshort = str_replace("http://","",$lastpostshort);<br /> ... str_replace("","",$lastpostshort); $lastpostshort = str_replace("http://","",$lastpostshort);<br /> ... str_replace("","",$lastpostshort); }
فقمت بالتالي :
وأيضاً نجح ودون مشاكلكود:$query20 = "SELECT pagetext,postid,dateline,iconid FROM post WHERE threadid='$thread[threadid]' ORDER BY dateline DESC LIMIT 2"; $lastpost10 = mysql_query($query20) or die("MySQL reported this error while trying to retrieve the last post info: ".mysql_error()); while ($lastpost30 = mysql_fetch_array($lastpost10)) { $lastpostshort10 = $lastpost30[pagetext]; $lastpostshort10 = nl2br($lastpostshort10); $lastpostshort10 = str_replace("","<i>",$lastpostshort10); $lastpostshort10 = str_replace("","</i>",$lastpostshort10); $lastpostshort10 = str_replace("","<u>",$lastpostshort10); $lastpostshort10 = str_replace("","</u>",$lastpostshort10); $lastpostshort10 = str_replace("","<b>",$lastpostshort10); $lastpostshort10 = str_replace("","</b>",$lastpostshort10); $lastpostshort10 = str_replace("","<i>",$lastpostshort10); $lastpostshort10 = str_replace("","</i>",$lastpostshort10); $lastpostshort10 = str_replace("","<u>",$lastpostshort10); $lastpostshort10 = str_replace("","</u>",$lastpostshort10); $lastpostshort10 = str_replace("","<b>",$lastpostshort10); $lastpostshort10 = str_replace("","</b>",$lastpostshort10); $lastpostshort10 = str_replace("[img]","<img border=\"0\" src=\"",$lastpostshort10); $lastpostshort10 = str_replace("[/img]","\">",$lastpostshort10); $lastpostshort10 = str_replace("[IMG]","<img border=\"0\" src=\"",$lastpostshort10); $lastpostshort10 = str_replace("[/IMG]","\">",$lastpostshort10); $lastpostshort10 = str_replace("http://","",$lastpostshort10);<br />... str_replace("","",$lastpostshort10); $lastpostshort10 = str_replace("http://","",$lastpostshort10);<br />... str_replace("","",$lastpostshort10); }
ولكن واجهتني مشكله
في حال كان pagetext هو نفسه تظهر النتيجه متكرره
اي ان threadid من خلال الجدول يرتبط فقط في postid واحد
هل هناك شرط مكن الممكن وضعه لمعرفة اذا كانت نتيجة الاستعلام تحمل اكثر من pagetext واحد او واحد فقط ؟
على الله يكون السؤال واضح




