Jump to content

RDKL PerFecT

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Everything posted by RDKL PerFecT

  1. [code]$sql = mysql_query("SELECT * FROM Links ORDER BY id asc WHERE ok='1' LIMIT $from, $max_results"); $offset = ($page-1)*$max_results; $start = 1; while($row = mysql_fetch_array($sql)){ //    $n = $i++ +1;        //add 1 so that numbers don't start with 0     $n = $offset + $start;     $start++;          //RESULTS     echo "<tr>\n";         echo "<td>$n.</td>\n";         echo "<td><a href='govisit.php?id=".$row["id"]."' target='_blank'>".$row["linkname"]."</a></td>\n";         echo "<br><td>".$row["description"]."</td>\n";         echo "<td><b><a href=\"$url\" target=\"_blank\">".$row["linkname"]."</a> has received ".$row["hits"]." hits from the RDKL LinkBase</b></td>         </tr>\n";         echo "<tr><td colspan='4'><hr></td></tr>\n";   } [/code] Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/html/site/links/rdk.links2.php on line 134 Is my error, any help is appreciated
  2. Basically I want to get all fields from a table and add them together. The following code contains an error. [code]$q2 = mysql_query("select sum(vote) as votesum from portal_votes"); [/code] I get the following error: Problem with query: Resource id #4 You have an error in your SQL syntax near 'Resource id #4' at line 1. If anyone can help me out I would be most greatful.
  3. So I've found a user's IP and registered as a variable in a DB. Is there any way I can now ban it? Cheers.
  4. [!--quoteo(post=363174:date=Apr 10 2006, 04:07 AM:name=IceHawk)--][div class=\'quotetop\']QUOTE(IceHawk @ Apr 10 2006, 04:07 AM) [snapback]363174[/snapback][/div][div class=\'quotemain\'][!--quotec--] If you're using my while loop, there's a slight mistake I just noticed. If you replace $n = $i + 1; with; $n = $i++ + 1; Then you should be good to go. [/quote] Thank you. Ok, That's sorted, I then have one final problem. When a new page starts (e.g. board(1).php?page=2) it re-starts the counter from 1, instead of what effectively should be 16. Check [a href=\"http://www.rdkleague.com/marathon/board(1).php\" target=\"_blank\"]This Page[/a] to see what the hell I'm on about. Again, thanks for any help you can offer.
  5. [!--quoteo(post=362914:date=Apr 9 2006, 03:50 AM:name=IceHawk)--][div class=\'quotetop\']QUOTE(IceHawk @ Apr 9 2006, 03:50 AM) [snapback]362914[/snapback][/div][div class=\'quotemain\'][!--quotec--] Where is $nrows being set? Based just off what you posted here, $nrows doesn't exist so the loop will never run. You would need to do something like ; $nrows = mysql_fetch_rows($sql); Or you could do; [code] $sql = mysql_query("SELECT * FROM Players ORDER BY Points DESC LIMIT $from, $max_results"); while($row = mysql_fetch_array($sql)){     $n = $i +1;        //add 1 so that numbers don't start with 0                  // Build your formatted results here.     echo("<tr bgcolor=".$bgcolor."><td>");     echo($row["Name"]);     echo("</td><td>");     echo($row["Nationality"]);     echo("</td><td>");     echo($row["Points"]);     echo("</td></tr>"); } [/code] With the above, the loop will run for each row returned by the query, and each row will be entered into $row for you. So there is no need for the for loop. [/quote] I've found this code from another script of how to number things, which sets $nrows like you said. I now get it to each "$n.", which just shows up as 1. for each row instead of 1,2,3,4 etc. Any way I can fix this? [code]$query = "SELECT url,linkname,id,description,hits FROM Links WHERE ok='1' ORDER by url desc"; $result = mysql_query($query)     or die ("Couldn't execute query."); $nrows = mysql_num_rows($result);[/code]
  6. Hi there, this is my code // Perform MySQL query on only the current page number's results. The problem is it doesn't echo anything at all now, since I've tried to add this nrows thing to make each result numbered, any help would be greatly appreciated. [code] $sql = mysql_query("SELECT * FROM Players ORDER BY Points DESC LIMIT $from, $max_results"); for ($i=0;$i<$nrows;$i++)     {         $n = $i +1;        //add 1 so that numbers don't start with 0         $row = mysql_fetch_array($sql);         extract($sql);              // Build your formatted results here.     echo("<tr bgcolor=".$bgcolor."><td>");     echo($row["Name"]);     echo("</td><td>");     echo($row["Nationality"]);     echo("</td><td>");     echo($row["Points"]);     echo("</td></tr>");     } [/code]
  7. Yeah, I basically just want it so that when a user logs in, cookies keep them logged in. Here is my login form and checklogin.php LOGINForm [code] <form action="Login Page" method="post"><br />           <input type="text" name="username" size="17">           <input type="password" name="password" size="17">           <input type=submit name=Submit value=Submit!> [/code] Where Login is Checked [code]// Convert password to md5 hash $password = md5($password); // check if the user info validates the db $sql = mysql_query("SELECT * FROM Members WHERE username='$username' AND password='$password' AND Activation='1'"); $login_check = mysql_num_rows($sql);[/code] If anyone can help with this I would be most greatful.
  8. For some reason, whether logged in or not, this page echoes nothing. [code] include 'db.php'; if (isset($_SESSION['username'])) {     $query = "SELECT Paid FROM partners WHERE gamertag='$username'";     $result = mysql_query($query) or die('Query failed: ' . mysql_error());     while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {            foreach ($line as $col_value) {              if ($col_value == "no") {                 include 'paypal1.html';                 echo "<br><br>Or alternatively, if you would like to pay for both and your partner, use the box below.<br>";                 include "paypal2.html";              } else {                 echo "You've already paid";              }           }        } } [/code]
  9. [!--quoteo(post=340927:date=Jan 29 2006, 08:04 PM:name=pojax)--][div class=\'quotetop\']QUOTE(pojax @ Jan 29 2006, 08:04 PM) [snapback]340927[/snapback][/div][div class=\'quotemain\'][!--quotec--] I tried to upload a new template but didnt really work when i configured it. All pages say. phpBB : Critical Error Could not open Ace Green template config file DEBUG MODE Line : 361 File : functions.php That line comes out to message_die(CRITICAL_ERROR, "Could not open $template_name template config file", '', __LINE__, __FILE__); I need to get it back the regular subsilver theme! Any help? I cant even get to the admin.php [/quote] did you install phpbb yourself or with an auto-installer? PHPBB coding is quite advanced, but if you've edited something on that page it may be worth re-downloading the page.
  10. [!--quoteo(post=272070:date=Aug 28 2005, 02:45 AM:name=steelmanronald06)--][div class=\'quotetop\']QUOTE(steelmanronald06 @ Aug 28 2005, 02:45 AM) 272070[/snapback][/div][div class=\'quotemain\'][!--quotec--] Are you a male or female programmer? Teen or Adult. I have never met other teen programers nor female programmers. After voting, add a bit of info about yourself like I have below: ***************************** My name is Ronald Steelman. I first started programming when I was 14 years old and I am now 18. I don't know as much as I would like, I never will, but I learn more everyday. I am a male of course. I started at like 13, 2 or 3 years ago. Mainly only really done html and php, but hopefully some JS, CSS, and C++ in the near future.
×
×
  • 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.