The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 4 of 4

Thread: PAGE IS RUNNING SLOW!!

  1. #1

    PAGE IS RUNNING SLOW!!

    Could someone please help me??

    I've made a tabel in php that corresponds with a mysql database.Now the problem is that it is running very slow. Maybe because i used a wrong loop or is it the query that i'm using?
    I only want to show de last 14 rows of de database because it contains much more but i don't want to show that.

    I'm using the following code:

    PHP Code:
    <?php
    // Connect naar de server and select een database
    $link mysql_connect("blablabla") or die ("could not connect");
    mysql_select_db ("blablala") or die ("could not select database");
    // Voer Sql query uit
    $query"SELECT * FROM blablabla GROUP BY id DESC LIMIT 14";
    $result_handle mysql_query($query) or die ("Query failed");
    /*
    Print het resultaat in een HTML tabel
    Eerste benadering: krijg het resultaat als een associatief array
    */
    print "<table bgcolor='white' width='100%' cellSpacing=0 cellPadding=1 border=0 align='left'>\n
    <th bgcolor='363636' width='5'></th>
    <th bgcolor='363636' width='100' align='center'><font color='ffffff'>DATUM</font></th>
    <th bgcolor='363636' width='5'></th>
    <th bgcolor='363636' width='100' align='left'><font color='ffffff'>ARTIEST</font></th>
    <th bgcolor='363636' width='95' align='left'><font color='ffffff'>TITEL</font></th>
    <th bgcolor='363636' width='100' align='left'><font color='ffffff'>STEMMEN</font></th>
    <th bgcolor='363636' width='40'><font color='ffffff'>VS.</font></th>
    <th bgcolor='363636' width='5'></th>
    <th bgcolor='363636' width='100' align='left'><font color='ffffff'>ARTIEST</font></th>
    <th bgcolor='363636' width='95' align='left'><font color='ffffff'>TITEL</font></th>
    <th bgcolor='363636' width='100' align='left'><font color='ffffff'>STEMMEN</font></th>
    <th bgcolor='363636' width='100' align='center'><font color='ffffff'>WINNAAR</font></th>
    <th bgcolor='363636' width='5'></th>
    <tr height='5'>\n
    </tr>\n
    "
    ;
    $teller 1;
    while (
    $row =  mysql_fetch_array($result_handle,MYSQL_ASSOC)){
    if (
    $teller == 1) {
    print 
    "<tr bgcolor='e6e6e6'>\n";
    } else {
    print 
    "<tr bgcolor='ffffff'>\n";

    $teller++; 
    // lees alle velden van deze rijen uit de database
    $datum $row["datum"];
    $artiesteerste $row["artiest1"];
    $titeleerste $row["titel1"];
    $stemmeneerste $row["stemmen1"];
    $plaatjeerste $row["plaatje1"];
    $artiesttwee $row["artiest2"];
    $titeltwee $row["titel2"];
    $stemmentwee $row["stemmen2"];
    $plaatjetwee $row["plaatje2"];
    $winnaar $row["winnaar"];
    // print alle velden in hun respectieve colommen van de tabel
    print "<td width='5'></td>\n
    <td bgcolor='cccccc' width='100' align='center'>
    $datum</td>\n
    <td width='100' align='center'><img src= 
    $plaatjeerste /></td>\n
    <td width='100' align='left'>
    $artiesteerste</td>\n
    <td width='95' align='left'>
    $titeleerste</td>\n
    <td width='100' align='left'>
    $stemmeneerste</td>\n
    <th bgcolor='ffffff' width='40'>VS.</th>\n
    <td width='100' align='center'><img src= 
    $plaatjetwee /></td>\n
    <td width='100' align='left'>
    $artiesttwee</td>\n
    <td width='95' align='left'>
    $titeltwee</td>\n
    <td width='100' align='left'>
    $stemmentwee</td>\n
    <th bgcolor='fe3baf'width='100' align='center'><font color='ffffff'>
    $winnaar</font></th>\n
    <td width='5'></td>\n
    </tr>\n
    <tr height='5'>\n
    </tr>\n"
    ;
    }
    //while
    print "</table>\n";
    //close connection
    mysql_close($link);
    ?>
    Thank u very much!!

  2. #2
    here's what i would do:
    1. switch your double quotes to single quotes with variable concatenation instead when you print out
    2. remove your GROUP BY because it's not doing anything
    3. remove your styling HTML and use CSS instead

  3. #3
    Quote Originally Posted by bwh2 View Post
    here's what i would do:
    1. switch your double quotes to single quotes with variable concatenation instead when you print out
    2. remove your GROUP BY because it's not doing anything
    3. remove your styling HTML and use CSS instead
    I've tried but it doesn't work!! i don't get it!

  4. #4

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012