Query a big data to mysql with a fastest speed loading !

June 19, 2011 by PetuaTerbaik · Leave a Comment
Filed under: Software, Troubleshooting 

First of all thanks to noorahmad to start the code, and i just fix the bug for the previous and next from ur code…

here is a big data solution… if you have 6 Milion Rowset… how to retrieve it fast?? so here is the solution..

</p>

<p><?php<br />
 $host = '';<br />
 $user = '';<br />
 $pass = ';<br />
 $db = 's';<br />
 $tblname ='ibu';<br />
 $con = mysqli_connect($host,$user,$pass,$db)or die(mysqli_error($con));<br />
 $limit = 10;    // show 10 records<br />
 if((isset($_GET['next']))){<br />
 $n = $_GET['next']+10;<br />
 $page_str = "SELECT * FROM $tblname ORDER BY id DESC LIMIT $n,$limit";<br />
 }<br />
 else{<br />
 if((!isset($_GET['prev']))){<br />
 $n = 10;<br />
 $page_str = "SELECT * FROM $tblname ORDER BY id DESC LIMIT $n,$limit";<br />
 }else {<br />
 $n = $_GET['prev']+10;<br />
 $page_str = "SELECT * FROM $tblname ORDER BY id DESC LIMIT $n,$limit";<br />
 }<br />
 }</p>

<p>echo "PREV: " . $_GET['prev'] . "<br>";<br />
 echo "NEXT: " . $_GET['next'] . "<br>";<br />
 //if($_GET['next'] == 10){<br />
 //    $p = $_GET['prev'] -0;<br />
 //    $n = -0;<br />
 //    $page_str = "SELECT * FROM $tblname ORDER BY id DESC LIMIT $p,$limit";<br />
 //}</p>

<p>if(isset($_GET['next'])){<br />
 //echo "<br>i dah set get next jadi tolak 10<br>";<br />
 if ($_GET['next'] != 10) { <br />
 $p = $_GET['next'] -10;<br />
 }else {<br />
 $p = $_GET['next'] -0;<br />
 }<br />
 }</p>

<p>if(isset($_GET['prev'])){<br />
 $p = $_GET['prev'] - 10;<br />
 $page_str = "SELECT * FROM $tblname ORDER BY id DESC LIMIT $p,$limit";<br />
 }</p>

<p>//$page_query = mysqli_query($con,$page_str)or die(mysql_error($con));<br />
 $page_query = mysqli_query($con,$page_str)or die(("error!"));</p>

<p>//if((isset($_GET['next']) && $_GET['next']>10) || (isset($_GET['prev']) && $_GET['prev']>10)){<br />
 if((isset($_GET['next']) && $_GET['next']>=10) || (isset($_GET['prev']) && $_GET['prev']>10)){<br />
 echo "<a href='?prev=$p'> Prev </a>";<br />
 }<br />
 if(mysqli_num_rows($page_query)>=10){<br />
 echo "| <a href='?next=$n'>Next</a> | ";<br />
 }</p>

<p>echo "<br />";<br />
 while($page_result = mysqli_fetch_assoc($page_query)){<br />
 //echo "$page_result[id] = $page_result[col1] : $page_result[date]<br />";<br />
 echo "$page_result[ID]" . "<br>";<br />
 }</p>

<p>?></p>

<p>

Incoming search terms:

  • lajukan internet pejabat (4)
  • add big data to mysql (2)
  • melajukan mediaget (2)
  • manual lajukan internet (2)
  • lajukan wireless (2)
  • lajukan umobile (2)
  • lajukan internet handphone (2)
  • eperolehan pakai win7 (2)
  • eperolehan loading lambat (2)
  • show fastest query mysql big data (2)

Bagaimana nak lajukan database mysql anda

June 18, 2011 by PetuaTerbaik · Leave a Comment
Filed under: Software, Troubleshooting 

Assalamualaikum bertemu lagi… mungkin ramai yang tertanya-tanya… nape ye kalau database dah ada 6 juta rekod tiba2 jadi slow??

Well, the clue is design of the programming… kalau programming tu cantik ringan.. Insya’Allah 6 juta rekod boleh jadi  Query took 0.0017 sec..

jadi mesti ramai yang dah gunakan built Dreamweaver Server behavior… wuhuuu… syed tadi just eksperimen dummy data…

so kirer memang lambat giler…. kalau pakai built dreamweaver punye query… so avoid gune dreamweaver built in Server Behavior…..

So cammane? just gune manual coding la…

Incoming search terms:

  • lajukan mobile internet (14)
  • melajukan umobile (10)
  • bagaimana nak lajukan u mobile (8)
  • lajukan wireless (8)
  • lajukan internet umobile (8)
  • lajukan u mobile hack (6)
  • lajukan umobile (6)
  • bagaimana untuk melajukan internet u mobile (6)
  • alat untuk lajukan kereta (6)
  • bagaimana nak remove security database (6)
  • lajukan internet pejabat (4)
  • lajukan u mobile (4)
  • bagaimana nak terminate u mobile (4)
  • how to hack umobile internet using iphone (4)
  • cars nak lajukan umobile internet (4)
  • bagaimana nak melajukan internet (4)
  • bagaimana melajukan umobile (4)
  • melajukan u mobile (4)
  • lajukan word (4)
  • alat untuk lajukan (4)

Images hosting provided by ImageShack Via ImageShack Migration plugin

Desclaimer : This website and the Materials are provided "as is" and "as available", without warranty of any kind, implied, express or statutory. Petua Terbaik or PetuaTerbaik.kaer-media.org shall not be liable for any loss or damage caused by the usage of any information or Materials obtained from this website. We are also not hosting the material, the material we get are only link from other site. Penafian : Petua Terbaik tidak bertanggungjawab terhadap sebarang kehilangan atau kerosakan yang dialami kerana menggunakan maklumat dalam laman ini. Kami juga tidak membekalkan bahan di server kami, bahan yang kami dapat adalah pautan dari web yang lain.
This site is protected by WP-CopyRightPro