النتائج 1 إلى 3 من 3

الموضوع: الإستعلامات وسؤال آخر

  1. #1
    تسجيل غير مقبول
    تاريخ التسجيل
    Nov 2002
    المشاركات
    250

    الإستعلامات وسؤال آخر



    السلام عليكم

    عملت الاستعلام التالي :
    كود:
    		$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 واحد او واحد فقط ؟

    على الله يكون السؤال واضح







    LATE غير متواجد حالياً


  2. #2
    عضو فعال
    تاريخ التسجيل
    Nov 2002
    المشاركات
    1,602


    والله مافهمت سؤالك عدل

    اذا كنت تقصد اذا كان ناتج الاستعلام واحد او اكثر



    كود PHP:
    $r=mysql_num_rows($query20) ;
    if(
    $r ==1){
    //
    }elseif($r 1){
    //







    __________________
    المغردون العرب
    all-the-vb غير متواجد حالياً

  3. #3
    تسجيل غير مقبول
    تاريخ التسجيل
    Nov 2002
    المشاركات
    250


    سلام عليكم

    اعيد السؤال ببساطه

    الاستعلام الاول استخدمت فيه التالي :

    كود PHP:
    ORDER BY dateline LIMIT 1 
    الاستعلام الثاني استخدمت فيه التالي :

    كود PHP:
    ORDER BY dateline DESC LIMIT 2 
    المشكله اذا كانت النتيجه في كلا الاستعلامين واحده فانها تتكرر ..

    اريد ان اتخلص من التكرار فقط





    LATE غير متواجد حالياً





ضوابط المشاركة

  • لا تستطيع إضافة مواضيع جديدة
  • لا تستطيع الرد على المواضيع
  • لا تستطيع إرفاق ملفات
  • لا تستطيع تعديل مشاركاتك
  •  

أضف موقعك هنا| اخبار السيارات | حراج | شقق للايجار في الكويت | بيوت للبيع في الكويت | دليل الكويت العقاري | مقروء | شركة كشف تسربات المياه | شركة عزل اسطح بالرياض | عزل فوم بالرياض| عزل اسطح بالرياض | كشف تسربات المياة بالرياض | شركة عزل اسطح بالرياض