Jump to content

Deivas

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Deivas's Achievements

Member

Member (2/5)

0

Reputation

  1. Deivas

    Sorting

    Ok, When I do SELECT name, votes AS votes, @num := @num +1 AS Rank FROM `servers` a, ( SELECT @num :=0 )b ORDER BY votes DESC LIMIT 0 , 10 and when I go to the next page, it starts from 1 again?
  2. Deivas

    Sorting

    For example... I have: +------------------+---------+ | ID____________| VOTES_ | +------------------+---------+ |1_____________ | 55 ____| +------------------+---------+ |2_____________ | 99 ____| +------------------+---------+ ... and how can I make so it will be like this: +------------------+---------+ | # ____________| VOTES_ | +------------------+---------+ |1_____________ | 99 ____| +------------------+---------+ |2_____________ | 55 ____| +------------------+---------+
  3. $rank = 0; while($info = mysql_fetch_array( $result )) { $rank++; Print "<tr>"; Print "<td><a href=\"?id=" . $info['id'] . "\">" .$info['name'] . "</a></td> "; Print "<td>".$info['ip'] . " </td>"; Print "<td>".$info['port'] . " </td>"; Print "<td>".$info['shortdesc'] . " </td>"; Print "<td>".$info['type'] . " </td>"; Print "<td>".$info['username'] . " </td>"; Print "<td>".$info['votes'] . " </td>"; } echo "</tbody>"; Print "</table>"; When I go to the next page $rank starts from 0 again.
  4. Ok, I have this: $rowsPerPage = 50; $pageNum = 1; if(isset($_GET['page'])) { $pageNum = $_GET['page']; } $offset = ($pageNum - 1) * $rowsPerPage; $type = $_GET['type']; $query = " SELECT * FROM servers WHERE type = '$type'" . " LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die('Error, query failed'); echo " <table border=\"0\" id=\"hor-minimalist-b\"> <thead> <tr> <th scope=\"col\">#</th> <th scope=\"col\">Name</th> <th scope=\"col\">URL/IP</th> <th scope=\"col\">Port</th> <th scope=\"col\">Short description</th> <th scope=\"col\">Type:</th> <th scope=\"col\">Added by</th> <th scope=\"col\">Votes</th> </tr> </thead> <tbody> "; $rank = 0; while($info = mysql_fetch_array( $result )) { $rank++; Print "<tr>"; Print "<td><a href=\"?id=" . $info['id'] . "\">" .$info['name'] . "</a></td> "; Print "<td>".$info['ip'] . " </td>"; Print "<td>".$info['port'] . " </td>"; Print "<td>".$info['shortdesc'] . " </td>"; Print "<td>".$info['type'] . " </td>"; Print "<td>".$info['username'] . " </td>"; Print "<td>".$info['votes'] . " </td>"; } echo "</tbody>"; Print "</table>"; $query = "SELECT COUNT(*) AS numrows FROM servers WHERE type='rsps'"; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; $maxPage = ceil($numrows/$rowsPerPage); $self = $_SERVER['PHP_SELF']; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) { $nav .= " $page "; } else { $nav .= " <a href=\"$self?page=$page&type=$type\">$page</a> "; } } if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page&type=$type\">[Prev]</a> "; $first = " <a href=\"$self?page=1&type=$type\">[First Page]</a> "; } else { $prev = ' '; $first = ' '; } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page&type=$type\">[Next]</a> "; $last = " <a href=\"$self?page=$maxPage&type=$type\">[Last Page]</a> "; } else { $next = ' '; $last = ' '; } echo $first . $prev . $nav . $next . $last; When I go to the next page, the $ranks starts over again. How can I make it to continue counting.
  5. I don't mean to sound offensive if I am, but are you 12? You cannot edit your web page with this code, You can manipulate it but refreshing will remove anything you have done. Dreamweaver is expensive and pointless, you may as well get something free/open source and good such as NVU I was trying to edit the post but it didn't met me. I use javascript:document.body.contentEditable='true'; document.designMode='on'; void 0 this when I make like news pages, so I can see what it will look like on the page, I was just wondering if there is a free program like "DreamWeaver".
  6. <?php $Question["1"] = '1-A'; $Question["2"] = '2-A'; $Question["3"] = '1-A'; $Question["4"] = '2-A'; $Question["5"] = '1-B'; echo "1 - (" . $Question["1"] . ")<br />"; echo "2 - (" . $Question["2"] . ")<br />"; echo "3 - (" . $Question["3"] . ")<br />"; echo "4 - (" . $Question["4"] . ")<br />"; echo "5 - (" . $Question["5"] . ")<br />"; ?> or <?php $Question["1"] = '1-A'; $Question["2"] = '2-A'; $Question["3"] = '1-A'; $Question["4"] = '2-A'; $Question["5"] = '1-B'; echo "1(" . $Question["1"] . "),"; echo "2(" . $Question["2"] . "),"; echo "3(" . $Question["3"] . "),"; echo "4(" . $Question["4"] . "),"; echo "5(" . $Question["5"] . ")"; ?>
  7. Hey, is it possible to edit your website live (like when you enter: javascript:document.body.contentEditable='true'; document.designMode='on'; void 0 into your address bar)? I need this because I can't afford to buy DreamViewer. If not, how can I add javascript:document.body.contentEditable='true'; document.designMode='on'; void 0 to my website so I will not have to keep entering it every time i edit my website?
  8. Deivas

    $_GET

    I have a lot of links in my website, and on most of them I need to do this (this might be wrong) : if($_GET['type'] != null){ if($_GET['order'] == null){ $nav .= " <a href=\"$self?page=$page&&type=$type\">$page</a> "; } if($_GET['order'] != null){ $nav .= " <a href=\"$self?page=$page&&type=$type&&order=$order\">$page</a> "; } } if($_GET['type'] == null){ $nav .= " <a href=\"$self?page=$page\">$page</a> "; } and etc , I am asking if it is possible to do it faster?
  9. Deivas

    $_GET

    Is there an easier way to make hyperlinks with $_GET because when I make a hyperlink I need to do if statements to see if the site is using it.
  10. I fixed it all. Thanks for all your help
  11. For example I have: $data123 = mysql_query("SELECT * FROM servers WHERE type = '$type' LIMIT $offset, $rowsPerPage") or die(mysql_error()); If the type is not selected nothing prints out. What can I do to make it if nothing is selected all results print out?
  12. Deivas

    $_GET

    Thanks. Jeez, I love this forum.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.