Jump to content

RealDrift

Members
  • Posts

    158
  • Joined

  • Last visited

    Never

Everything posted by RealDrift

  1. <?php $limit = 10; $query_count = "SELECT count(*) FROM goldies WHERE Sender='$username'"; $result_count = mysql_query($query_count); $totalrows = mysql_result ($result_count, 0, 0); if(empty($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } $limitvalue = $page * $limit - ($limit); $query = "SELECT * FROM goldies WHERE Sender='$username' LIMIT $limitvalue, $limit"; $result = mysql_query($query) or die("Error: " . mysql_error()); if(mysql_num_rows($result) == 0){ echo("Nothing to Display!"); } $bgcolor = "#737373"; // light gray echo("<table>"); while($row = mysql_fetch_array($result)){ if ($bgcolor == "#737373"){ $bgcolor = "#737373"; }else{ $bgcolor = "#E0E0E0"; } echo("<tr bgcolor=".$bgcolor."><td>"); echo($row["Receiver"]); echo("</td><td>"); echo($row["Amount"]); echo("</td><td>"); echo($row["Date"]); echo("</td></tr>"); } echo("</table>"); if($page != 1){ $pageprev = $page--; echo("<a href=\"creditshistory.php?page=$pageprev\">PREV</a> "); }else{ echo("PREV "); } $numofpages = $totalrows / $limit; for($i = 1; $i <= $numofpages; $i++){ if($i == $page){ echo($i." "); }else{ echo("<a href=\"creditshistory.php?page=$i\">$i</a> "); } } if(($totalrows % $limit) != 0){ if($i == $page){ echo($i." "); }else{ echo("<a href=\"creditshistory.php?page=$i\">$i</a> "); } } if(($totalrows - ($limit * $page)) > 0){ $pagenext = $page++; echo("<a href=\"creditshistory.php?page=$pagenext\">NEXT</a>"); }else{ echo("NEXT"); } mysql_free_result($result); ?>
  2. The links work in a way now. The page number links do work, however the current page number should not be clickable as you are already veiweng that page, but now the current page is clickable but the page number before current page number is not clickable. And the next and prev links work but the other way around. "NEXT" actually takes you to the previous page and vice versa
  3. This whole script was from a tutorial from this very website, so i assumed it would be correct. If i knew it had this many problems i would have left it alone. I am not a super coder, my php coding level is around intermediate. I can't do this on my own. I had been staring at this script for like an hour before i came here.
  4. i fixed the slashes and removed the "game" directory out and removed the "&" sign and put in "?" but still not working
  5. i fixed the slashes and removed the "game" directory out but don't know what you mean by ampersand thungy
  6. ok i fixed links and they are now clickable however when i click them the page doesn't change to show the different data supposed to be on the new page number i clicked but only reloads to show data on page "1"
  7. Now i see all the pages instead of just "1" i saw before. Although the page numbers are clickable and the words "NEXT" and "PREV" when i click them i get the white page saying "Object not found!"
  8. i replaced the bit of code you gave me and it still dsnt seem to work
  9. HI, I read a tutorial on how to turn my results query from the db into pages for easy user reading. It all worked out. The table was echoed with results. However the links "PREV" and "NEXT" do not work, they are unclickable. Between these two links should be the pages in a row, i know for a fact that my query would produce around 4 pages yet the result page lists only one. I am currently developing the website on my pc using XAMPP, just so you know. I have tried fixing this problem and have failed. Please could someone solve this problem, i would highly appreciate it. <?php $limit = 7; $query_count = "SELECT count(*) FROM goldies WHERE Sender='$username'"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); if(empty($page)){ $page = 1; } $limitvalue = $page * $limit - ($limit); $query = "SELECT * FROM goldies WHERE Sender='$username' LIMIT $limitvalue, $limit"; $result = mysql_query($query) or die("Error: " . mysql_error()); if(mysql_num_rows($result) == 0){ echo("Nothing to Display!"); } $bgcolor = "#737373"; // light gray echo("<table>"); while($row = mysql_fetch_array($result)){ if ($bgcolor == "#737373"){ $bgcolor = "#737373"; }else{ $bgcolor = "#E0E0E0"; } echo("<tr bgcolor=".$bgcolor."><td>"); echo($row["Receiver"]); echo("</td><td>"); echo($row["Amount"]); echo("</td><td>"); echo($row["Date"]); echo("</td></tr>"); } echo("</table>"); if($page != 1){ $pageprev = $page--; echo("<a href=\"\game\creditshistory.php&page=$pageprev\">PREV".$limit."</a> "); }else{ echo("PREV".$limit." "); } $numofpages = $totalrows / $limit; for($i = 1; $i <= $numofpages; $i++){ if($i == $page){ echo($i." "); }else{ echo("<a href=\"\game\creditshistory.php?page=$i\">$i</a> "); } } if(($totalrows % $limit) != 0){ if($i == $page){ echo($i." "); }else{ echo("<a href=\"\game\creditshistory.php?page=$i\">$i</a> "); } } if(($totalrows - ($limit * $page)) > 0){ $pagenext = $page++; echo("<a href=\"\game\creditshistory.php?page=$pagenext\">NEXT".$limit."</a>"); }else{ echo("NEXT".$limit); } mysql_free_result($result); ?>
  10. i cant get my head around this AJAX stuff. Could anyone help me code a refresh code?
  11. any pointers to a refresh code for that? and whats so funny? lol
  12. what is AJAX? and what do u mean? sorry if i sound dum
  13. Hi, I basically have two frames on my page, the top one contains users stats and the bottom frame contains the website. I want to have a message icon on the top frame which would flash once the user gets a new message. Obviously I would have one message icon which doesn't flash and another which does. Right now i refresh the top frame every 30 seconds so that the stats update. But is there an easier way to refresh? I mean right now the whole top frame refreshes which can get annoying. Is there any PHP code which would automatically update a stat once there is a change in it? Please let me know. Thanks
  14. ok, thanks poco i will look over the original and example. I am also grateful for your encouragement and telling me not to lose confidence. thanks again
  15. yes poco that works!!!!!!!! thanks so much man i know how frustrating this script was, thanks thanks thanks for my learning experience i will compare the original script and the one you edited. But can you tell me generally why this simple script didn't work in the first place? this script has made me lose my confidence in coding in php.
  16. poco, thanks a lot for ur help so far its 3:06am here in the UK,London, i am gonna head to bed please post any more suggestions, i will try them and inform you tommorow i having been banging my head on the wall trying to make the form work, something so simple yet so painful. I really appreciate your help
  17. lol sorry to say but it still doesn't put in a title why is it doing this? do we have to be so precise in the coding?
  18. i did auto_increment and updated code now on the same page above the table i get the following echoed: INSERT INTO `support` ( `writer`,`reply`,`read`,`ticket`,`time`,`title`,`category`) VALUES ('WentWorth','0','0','message testing',now(),'','Scam Report') its recognising the category now but not title
  19. i get this echoed on a completely new page: INSERT INTO `support` (`id`, `writer`,`reply`,`read`,`ticket`,`time`,`title`,`category`) VALUES ('','username','0','0','title',now(),'','') Duplicate entry '' for key 1 shouldn't it be genrating a new id? also looks like it still hasn't put in a value for id,category,title
  20. i uncommented the insert query the form submits a row into the table but the values for id,category and title are empty
  21. poco i applied ur changes and this time it echos that the ticket has been submitted! that still leaves the problem of inserting row in table
  22. nope i applied both changes but still get the same error of filling in all fields
×
×
  • 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.