شوّيت: شبكة كرة قدم اجتماعية




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

موضوع مغلق
 
LinkBack أدوات الموضوع
تسجيل غير مقبول
#1  
الإستعلامات وسؤال آخر

السلام عليكم

عملت الاستعلام التالي :
كود:
		$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 is offline   قديم 08-01-2004, 12:30 AM
عضو فعال
#2  

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

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



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







__________________
المغردون العرب
all-the-vb is offline   قديم 08-01-2004, 12:47 AM
تسجيل غير مقبول
#3  

سلام عليكم

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

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

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

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

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






LATE is offline   قديم 08-01-2004, 02:18 AM
موضوع مغلق


 

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

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

كود vB متاح
كود [IMG] متاح
كود HTML غير متاح
Trackbacks are متاح
Pingbacks are متاح
Refbacks are متاح



جميع الأوقات بتوقيت غرينتش +3. الوقت الآن هو 09:26 AM.