نظرة سريعة على مجريات يوم سوالف
الفائزون في المسابقة الأصغر لسوالف كاست

 

العودة   سوالف سوفت > قسم تطوير وبرمجة المواقع للمتقدمين > PHP
المدوّنات البحث مشاركات اليوم اجعل كافة المشاركات مقروءة

موضوع مغلق  
 
LinkBack أدوات الموضوع
ينتظر رسالة التوكيد
تاريخ التسجيل: Nov 2002-
#1 (permalink)  
الإستعلامات وسؤال آخر


السلام عليكم

عملت الاستعلام التالي :
كود:
		$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 غير متواجد حالياً   قديم 08-01-2004, 12:30 AM
عضو فعال
تاريخ التسجيل: Nov 2002-
#2 (permalink)  

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

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



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







__________________
نــــــــــحو سـوالف أفضل...
All-the-vb site
All-the-vb forum
all-the-vb غير متواجد حالياً   قديم 08-01-2004, 12:47 AM
ينتظر رسالة التوكيد
تاريخ التسجيل: Nov 2002-
#3 (permalink)  

سلام عليكم

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

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

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

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

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






LATE غير متواجد حالياً   قديم 08-01-2004, 02:18 AM
موضوع مغلق


 

أدوات الموضوع

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

كود [IMG] متاحة
كود HTML معطلة
Trackbacks are متاحة
Pingbacks are متاحة
Refbacks are متاحة



الساعة الآن: 10:09 PM بتوقيت المملكة العربية السعودية