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

الموضوع: كيف امنع هذا الاستعلام من اللخبطه ... الرجاء الدخول

  1. #1
    عضو نشيط
    تاريخ التسجيل
    Jan 2006
    المشاركات
    258

    كيف امنع هذا الاستعلام من اللخبطه ... الرجاء الدخول



    السلام عليكم



    عندي هذا الكود


    كود PHP:
    <?
          
    // show headline with photo
       
    $querypub "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 0,1";
          
    $qrypub = @mysql_query($querypub,$connect) or die ("Query salah");
        while (
    $pub mysql_fetch_array ($qrypub)) {
                    echo 
    "
                    <div class=\"newssubtitle\">
    $pub[subtitle]</div>
                      <div class=\"newstitle\"><a href=\"news.php?go=fullnews&newsid=
    $pub[id]\">$pub[title]</a></div>
                      <div class=\"newsdate\">
    $pub[ldate]</div>";
                          if (
    $pub[pq]==1) {
                          echo 
    "<a href=\"news.php?go=fullnews&newsid=$pub[id]\"><img src=\"$urlpath/newsgfx/$pub[photo]\" alt=\"\" border=\"0\" width=\"300\" align=\"center\" vspace=\"5\" hspace=\"5\"></a>
                        <div class=\"fotodesc\">
    $pub[photodesc]</div>";
                          } else {
                      }
                echo 
    "
                
    $pub[intro]";
       }
                
    ?>




    المشكلة اني اذا كررت نفس الاستعلام في الصفحة يلخبط


    يعني



    لاحظ السطر الأول

    $querypub = "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 0,1";



    انا يهمني

    DESC limit 0,1";

    لو كررت الاستعلام في نفس الصفحة

    DESC limit 1,2";


    وكررته مره ثالثة

    DESC limit 2,4";

    باعتبار اني اريد كل استعلام منفصل والغرض هو ترتيب تصميم الصفحة لعرض كل خبر منفصل عن الاخر


    طبعا المشكلة اني اذا كررت الكود اكثر من ثلاث مرات تقريبا في الصفحة

    يصير يطلعلي في الاستعلام الثاني خبرين وانا اطلب خبر واحد فقط

    وهذا الكود الي يتلخبط معي



    كود PHP:



    <?
          
    // show headline with photo
       
    $querypub "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 0,1";
          
    $qrypub = @mysql_query($querypub,$connect) or die ("Query salah");
        while (
    $pub mysql_fetch_array ($qrypub)) {
                    echo 
    "
                    <div class=\"newssubtitle\">
    $pub[subtitle]</div>
                      <div class=\"newstitle\"><a href=\"news.php?go=fullnews&newsid=
    $pub[id]\">$pub[title]</a></div>
                      <div class=\"newsdate\">
    $pub[ldate]</div>";
                          if (
    $pub[pq]==1) {
                          echo 
    "<a href=\"news.php?go=fullnews&newsid=$pub[id]\"><img src=\"$urlpath/newsgfx/$pub[photo]\" alt=\"\" border=\"0\" width=\"300\" align=\"center\" vspace=\"5\" hspace=\"5\"></a>
                        <div class=\"fotodesc\">
    $pub[photodesc]</div>";
                          } else {
                      }
                echo 
    "
                
    $pub[intro]";
       }
                
    ?>
       
       
       <?
          
    // show headline with photo
       
    $querypub "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 1,2";
          
    $qrypub = @mysql_query($querypub,$connect) or die ("Query salah");
        while (
    $pub mysql_fetch_array ($qrypub)) {
                    echo 
    "
                    <div class=\"newssubtitle\">
    $pub[subtitle]</div>
                      <div class=\"newstitle\"><a href=\"news.php?go=fullnews&newsid=
    $pub[id]\">$pub[title]</a></div>
                      <div class=\"newsdate\">
    $pub[ldate]</div>";
                          if (
    $pub[pq]==1) {
                          echo 
    "<a href=\"news.php?go=fullnews&newsid=$pub[id]\"><img src=\"$urlpath/newsgfx/$pub[photo]\" alt=\"\" border=\"0\" width=\"300\" align=\"center\" vspace=\"5\" hspace=\"5\"></a>
                        <div class=\"fotodesc\">
    $pub[photodesc]</div>";
                          } else {
                      }
                echo 
    "
                
    $pub[intro]";
       }
                
    ?>
       
       
       
       <?
          
    // show headline with photo
       
    $querypub "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 2,3";
          
    $qrypub = @mysql_query($querypub,$connect) or die ("Query salah");
        while (
    $pub mysql_fetch_array ($qrypub)) {
                    echo 
    "
                    <div class=\"newssubtitle\">
    $pub[subtitle]</div>
                      <div class=\"newstitle\"><a href=\"news.php?go=fullnews&newsid=
    $pub[id]\">$pub[title]</a></div>
                      <div class=\"newsdate\">
    $pub[ldate]</div>";
                          if (
    $pub[pq]==1) {
                          echo 
    "<a href=\"news.php?go=fullnews&newsid=$pub[id]\"><img src=\"$urlpath/newsgfx/$pub[photo]\" alt=\"\" border=\"0\" width=\"300\" align=\"center\" vspace=\"5\" hspace=\"5\"></a>
                        <div class=\"fotodesc\">
    $pub[photodesc]</div>";
                          } else {
                      }
                echo 
    "
                
    $pub[intro]";
       }
                
    ?>
       
       
       
       
       <?
          
    // show headline with photo
       
    $querypub "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 3,4";
          
    $qrypub = @mysql_query($querypub,$connect) or die ("Query salah");
        while (
    $pub mysql_fetch_array ($qrypub)) {
                    echo 
    "
                    <div class=\"newssubtitle\">
    $pub[subtitle]</div>
                      <div class=\"newstitle\"><a href=\"news.php?go=fullnews&newsid=
    $pub[id]\">$pub[title]</a></div>
                      <div class=\"newsdate\">
    $pub[ldate]</div>";
                          if (
    $pub[pq]==1) {
                          echo 
    "<a href=\"news.php?go=fullnews&newsid=$pub[id]\"><img src=\"$urlpath/newsgfx/$pub[photo]\" alt=\"\" border=\"0\" width=\"300\" align=\"center\" vspace=\"5\" hspace=\"5\"></a>
                        <div class=\"fotodesc\">
    $pub[photodesc]</div>";
                          } else {
                      }
                echo 
    "
                
    $pub[intro]";
       }
                
    ?>


    في انتظار الخبراء





    __________________
    من لا يشكر الناس لايشكر الله


  2. #2
    عضو فعال جدا
    تاريخ التسجيل
    Apr 2002
    المشاركات
    2,046


    السلام عليكم ورحمة الله وبركاته

    طبعا المشكلة اني اذا كررت الكود اكثر من ثلاث مرات تقريبا في الصفحة

    يصير يطلعلي في الاستعلام الثاني خبرين وانا اطلب خبر واحد فقط
    الاستعلام الثاني وهو:
    كود:
    $querypub = "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 1,2";
    طبيعي جدا انه يطلع خبرين

    لانك طلبت منه ذلك

    لوتريده يطلع خبر واحد بس خليه كالتالي:
    كود:
    $querypub = "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 1,1";






    __________________
    مدونتي





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

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

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