Jump to content

RealDrift

Members
  • Posts

    158
  • Joined

  • Last visited

    Never

Everything posted by RealDrift

  1. works like a charm thanks damato btw any technical names for the function where it hides lots of page numbers?
  2. oh god damato has put us in another problem lol i was so happy that this script was working
  3. [code][quote author=pocobueno1388 link=topic=170599.msg758980#msg758980 date=1197321223] But if you change $limit to "10" it works? That doesn't make sense... [/quote] no lol. the changing 10 to $limit is fine. it changes the amount of rows displayed to wahtever $limit is set to but damato told me to: change: Also, there will be errors if the page variable on the query is bad. You should always validate the data. if (isset($_GET['page'])) $page = $_GET['page']; else $page = 1; To this: due to somethign abotu validating your stuff. {code]$page = (isset($_GET['page']) && is_int($_GET['page']))?$_GET['page']:1; the $limit thing works, but the pages dnt change now due to what i changed above. [/code]
  4. yeh that fixed it but now pages dnt change, not again
  5. damato i changed what usaid and after i changed 10 to '$limit' i got following error: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''10'' at line 1
  6. consider this topic closed! thanks again to Poco and everyone else who helped.
  7. also if i change $limit to something like 15 or so it wll display 15 rows per page right or i gotta change sutting else?
  8. Poco...it....works.... so sleepy, thanks a lot for this man. You won't hate me for putting you through this will you? also is this script stable? it wont fuk up onc ei move my site to the real server will it?
  9. feeling tired poco, back hurting its 3am here, falling asleep on pc
  10. results: page1=10 rows page2=10 rows page3=7 rows Page1= SELECT * FROM goldies WHERE Sender='WeedHunteR' LIMIT 0,10 Page2= SELECT * FROM goldies WHERE Sender='WeedHunteR' LIMIT 7,10 Page3= SELECT * FROM goldies WHERE Sender='WeedHunteR' LIMIT 14,10
  11. Page1= SELECT * FROM goldies WHERE Sender='WeedHunteR' LIMIT 0,10 Page2= SELECT * FROM goldies WHERE Sender='WeedHunteR' LIMIT 7,10 Page3= SELECT * FROM goldies WHERE Sender='WeedHunteR' LIMIT 14,10 thought i might tell u the sql queries the script echoes on each page
  12. lol i changed the db name from i_horses to my one i added WHERE Sender='$username' to the second SQL query as it gave me the wrong info now it is giving right info like so: page1=10 rows page2=10 rows page3=7 rows
  13. sorry sensei that way the page reloads everytime to show page 1 data
  14. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''10'' at line 1
  15. if it says limit 10,20 it should display 10 rows am baffled aswell as to why it echoes 11 rows
  16. i have never used LIMIT before, so i wouldn't know poco
  17. also this is echoed above table: SELECT * FROM goldies WHERE Sender='WeedHunteR' LIMIT 0, 10
  18. Poco you are a Guru, no questions and yes the results are as follows: page 1 = 10 rows page 2 = 11 rows page 3 = 1 row which was the last row on page 2 maybe this has something to do with remainders when ya divide total rows by the amount of rows you want to see?
  19. I could kiss you all right now, for the help you have given to me lol
  20. POCO IT WORKS!!!! ahh man i am so happy thankyou man, thanks to you to sensei and teng, damato aswell this was one heck of a problem, thanks a lot for your time and effort
  21. i understand what u want me to do but i dnt think me and u r looking at the same script. The script i have now after changing it on urs and teng's command: <?php $username=$_SESSION['username']; $limit = 10; $query_count = "SELECT count(*) FROM goldies WHERE Sender='$username'"; $result_count = mysql_query($query_count) or die("Error: " . mysql_error()); $totalrows = mysql_result ($result_count, 0, 0); $numofpages = ceil($totalrows/$limit); // $page = (empty($_GET['page']) || !is_int($_GET['page']))?1:abs($_GET['page']); // // $limitvalue = ($page-1) * $limit; $page = (empty($_GET['page']) || !is_int($_GET['page']))?1:$_GET['page']; $end = $page *$limit; $start = $end-$limit; $query = "SELECT * FROM goldies WHERE Sender='$username' LIMIT $start, $end "; $result = mysql_query($query) or die("Error: " . mysql_error()); //Exit if no records to display if(mysql_num_rows($result) == 0){ exit("Nothing to Display!"); } //Create the table of output data echo "<table>\n"; while($row = mysql_fetch_array($result)){ //Alternate the row background color $bgcolor = ($bgcolor == "#737373")?'#737373':'#737373'; //Display the row of data echo "<tr bgcolor=\"$bgcolor\">\n"; echo " <td>".$row["Receiver"]."</td>\n"; echo " <td>".$row["Amount"]."</td>\n"; echo " <td>".$row["Date"]."</td>\n"; echo "</tr>"; } echo "</table>\n"; //Enable the Prev link if not first page if($_GET['page'] > 1){ echo("<a href=\"creditshistory.php?page=".($page-1)."\">PREV</a> "); }else{ echo("PREV "); } //Create links for each page in report for($i=1; $i<=$numofpages; $i++){ if($i == $_GET['page']){ echo "$i "; }else{ echo "<a href=\"creditshistory.php?page=$i\">$i</a> "; } } //Enable the Next link if not last page echo "page number : ". $page . " "; echo "number of pages : ". $numofpages; if($_GET['page'] != $numofpages){ echo("<a href=\"creditshistory.php?page=".($page+1)."\">NEXT</a>"); }else{ echo("NEXT"); } mysql_free_result($result); ?> its got some bits commented out, i am confused as hell
  22. thank poco, and sensei you want me to echo the following: echo "". $page . "";
  23. ok, i'll wait this will work won't it?
×
×
  • 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.