Jump to content

Deivas

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by Deivas

  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.
  13. Deivas

    $_GET

    How to find out if there is no $_GET method. At the moment I have an if statement: if($_GET['id']){ $link1 = mysql_connect("****","*****","*****"); mysql_select_db("*******", $link1); $result1 = mysql_query("SELECT * FROM servers WHERE id = $id", $link1); $num_rows1 = mysql_num_rows($result1); $data = mysql_query("SELECT * FROM servers WHERE id = $id") or die(mysql_error()); if($num_rows1 == 1){ while($info1 = mysql_fetch_array( $data )) { echo " <table border=\"1\"> <tr> <td><b>Name </a></td> <td>" .$info1['name'] ."</td> </tr> <tr> <td><b>Type </a></td> <td>" .$info1['type'] ."</td> </tr> <tr> <td><b>URL/IP: </b></td> <td>" .$info1['ip'] ."</td> </tr> <tr> <td><b>Port </b></td> <td>" .$info1['port']. "</td> </tr> <tr> <td><b>Description </b></td> <td>" .$info1['desc']. "</td> </tr> </table> <hr> <h4>Other information</h4> <table border=\"1\"> <tr> <td><b>Added by </b></td> <td>" .$info1['username']. "</td> </tr> <tr> <td><b>ID </b></td> <td>" .$info1['id']. "</td> </tr> <tr> <td><b>Date added (m/d/y) </b></td> <td>" .$info1['date']. "</td> </tr> </table> "; } } } What if statement should I do for normal stuff (just for index.php (not index.php?id=324234))?
  14. How do I make it so if someone clicks on a link and it will sort everything by votes descending and the link will change to something like : index.php?sort=votes Do I have to use $_GET method?
  15. Is it possible to add a website on a page, like include 'blah.php'; ? Because if I try to do include I get millions of errors that a file doesn't exist.
  16. Deivas

    -

    WRONG SECTION
  17. Ok thanks I knew it but I forgot about it Thanks
  18. How come that if i do that at my homepage it prints out the username. if(isSet($_SESSION['username'])) { echo $_SESSION['username'];}else{ echo "lol"; } if I do that in another directory it prints out lol.
  19. Deivas

    password

    Thanks Fixed it now.
  20. For example: My username is : Hello and my password is : bye. If I enter Hello and bye in the login it says "The submitted login info is incorrect.". But if I change my password to 123, it works. Can anyone tell me whats wrong? do_login.php <?php if(empty($_POST)) exit; include 'config.php'; include_once 'connect.php'; // declare post fields $post_username = $_POST['username']; $post_password = $_POST['password']; $post_autologin = $_POST['autologin']; $query = "select username,password from app_members where username='$post_username' and '$post_password'"; $result = mysql_query($query) or die("Could not query players"); $result2 = mysql_fetch_array($result); if ($result2) { $_SESSION['username'] = $post_username; // Autologin Requested? if($post_autologin == 1) { setcookie ($cookie_name, 'usr='.$config_username, time() + $cookie_time); } exit('OK'); } else { echo '<div id="error_notification">The submitted login info is incorrect.</div>'; } ?> login.php <?php require_once 'config.php'; // Is the user already logged in? Redirect him/her to the private page if(isSet($_SESSION['username'])) { header("Location: private.php"); exit; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>AJAX Login Form</TITLE> <META name="Author" Content="Bit Repository"> <META name="Keywords" Content="ajax, login, form, mootools"> <META name="Description" Content="A nice & simple AJAX Login Form"> <script type="text/javascript" src="js/mootools-1.2.1-core-yc.js"></script> <script type="text/javascript" src="js/process.js"></script> <link rel="stylesheet" type="text/css" href="style.css" /> </HEAD> <BODY> <center> <div id="status"> <fieldset><legend align="center">Authentication</legend> <div id="login_response"><!-- spanner --></div> <form id="login" name="login" method="post" action="do_login.php"> <table align="center" width="300" border="0"> <tr> <td width="80">Username</td><td><input id="name" type="text" name="username"></td> </tr> <tr> <td>Password</td> <td><input type="password" name="password"></td> </tr> <tr> <td> </td> <td><input type="checkbox" name="autologin" value="1">Remember Me</td> </tr> <tr> <td> </td> <td><input id="submit" type="submit" name="submit" value="Login"> <div id="ajax_loading"><img align="absmiddle" src="images/spinner.gif"> Processing...</div></td> </tr> </table> </form> </fieldset> </div> </center> </BODY> </HTML> if you will need anything else tell me.
  21. I have a database, a page to add websites, and a website to show the websites is http://darkdrift.net/lol/htdocs/StuffOnline/servers.php , as you can see it says "Please choose a type:" you choose a type from the select box and click "Continue" and then a list of websites show up. But when someone clicks on "Continue" I want the link to change to http://darkdrift.net/lol/htdocs/StuffOnline/servers.php?type=websites or something, and when I will finish that I will make it so if someone clicks on the name it will redirect to a page and it will show then information about the website, and the site will be something like: http://darkdrift.net/lol/htdocs/StuffOnline/servers.php?type=websites;id=4523
  22. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <link rel="stylesheet" href="./style.css" type="text/css"/> <title>Online Servers | Top list</title> <body> <?php include './includes/banner.php'; include './includes/menu.php'; ?> <div id="content"> <table id="content" width="86%" align="left"> <tr> <td><h1>Top List</h1><p> <form name="form1" action="servers.php" method="post"> Please choose a type: <select name="type"> <option value="website">Webistes</option> </select><br/> <input type="submit" value="Continue"/> </form> <hr/> <?php include 'connect.php'; $type = $_POST['type']; $sitequery = "SELECT * FROM site ORDER BY votes DESC"; $siteresult = mysql_query($sitequery); if($type == website) { return $site; while($row = mysql_fetch_array($siteresult, MYSQL_ASSOC)) { echo " Name : {$row['sitename']}</a> <br>" . "URL : {$row['siteurl']} <br>" . "Short description : {$row['shortdetails']} <br>" . "Votes : {$row['votes']} <br><hr><br>"; } } ?> </tr> </table> </div> </body> </html>
×
×
  • 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.