justAnoob
Members-
Posts
561 -
Joined
-
Last visited
Never
Everything posted by justAnoob
-
Sorry for the confusion, let me try to explain again Page 1: has a list of categories when user clicks on one of the categories, they are taken to a new page, which would look like this http://www.mysite.com/category.php?selecting=Video Games The above URL would be called page 2 Page 2: when page 2 is diplayed, there may be 500 video games to be listed which brings in my pagination. my pagination script is having probs working with my url from above because there is alreay a variable in it. Here is some of my pag script $targetpage = "category.php"; $page = mysql_escape_string($_GET['page']); <a href='$targetpage?page= Of course the page= could be a number of variables within my pagination script. I'm not sure but it almost seems like my $targetpage var should be someting like category.php?selecting=video games ..... this way my pagination script variables come after the complete url of whatever category was chosen. Does any get this?
-
I get an error on this line $page = mysql_escape_string($_GET['page']); when my url reads like this already http://www.mysite.com/category.php?selecting=Video Games This is hard to explain
-
Ok, The reason I ask is cause the page that loads has a URL like the following http://www.mysite.com/category.php?selecting=Video Games Video Games can differ depending on what category they choose on the previous page. Then, there is a pagination script with page numbers. $targetpage = "mypage.php"; <a href='$targetpage?page=1' So I would have to edit my $targetpage var ?
-
Can $_GET be used twice within one page? Meaning two different variables to be passed through the URL at the same time?
-
can't get it to work that way. The example below works, but I'm looking to change the display amount to 10, But I can't figure out what to change the if statement to so it will still work correctyly. <?php $startrow = $_GET['startrow'] ? $_GET['startrow'] : 0; $pages = intval($count / $display); if ($count % $display) { $pages++; } if ($pages > 1) { for ($i=1; $i <= $pages; $i++) { $next = $display * ($i - 1); echo '<a href="testing2.php?startrow=' . $next . '" class="active" > ' . $i . ' </a> '; } } $last = ceil($count / $display); if(! (($last + 6) < $startrow ) && $pages != 1) { $next = $startrow + $display; echo '<a href="testing2.php?startrow=' . $next . '" class="active" >Next >>></a> '; } else { echo '<span class="inactive">Next >>></span>'; } ?> Most of the code is from an example online that I found.
-
Well I tried that also, but it seems I am right back where I started. It does the same as the code I posted in my frist post. The Next button is always there no matter what page your on. I'm looking to have it there, unless your on the last page. Maybe I confused you.
-
I tried ceil and it still echos (nothing)
-
Nothing yet This is what I got <?php if (floor($startrow/$display) < $pages && $pages != 1) { echo ''; } else { $next = $startrow + $display; echo '<a href="testing2.php?startrow=' . $next . '">Next</a> '; } ?> This is my $startrow var below $startrow = $_GET['startrow'] ? $_GET['startrow'] : 0;
-
having trouble find last page for pagination. if i'm on the last page, i would like it to not show the "Next" button. Here is the echo for the "next button" if (!(($startrow / $display) == $pages) && $pages != 1) { $next = $startrow + $display; echo '<a href="testing2.php?startrow=' . $next . '">Next</a> '; } $count is my total number of rows from mysql and $display is the number of pics to be displayed on each page and this gets my total number of pages pages = intval($count / $display); This seems so simple, but I cannot get it to work.
-
hey thanks, could you explain what that means? btw, it worked.
-
Ok, I found an example online, and gave it a little tweak(not much) so I can get the idea of how pagination page numbers work. My page displays with the corrent amount of rows from the database that I want on a page. Here is the prob. When I click on a page number, the same entries are shown. Can anyone throw me a pointer. <?php include 'connection.php'; $cat = "DVDs"; $query = "SELECT id FROM my_table WHERE category = '$cat' "; $result = mysql_query($query); $count = mysql_num_rows($result); $display = 2; if (empty($startrow)) { $startrow=0; } $query2 = "SELECT thumb_1 FROM my_table WHERE category = 'DVDs' LIMIT $startrow, $display"; $result2 = mysql_query($query2); echo "<table border='0' CELLPADDING=5 STYLE='font-size:16px'>"; while ($row = mysql_fetch_array($result2)) { echo "<tr><td align='center'>"; echo '<a href="viewmovie.php?sendto='.$row['id'].'"><img src="' . $row['thumb_1'] . '" width="90" border="0" alt=""></a></td></tr>'; echo '<tr><td>'; echo '<hr width="550">'; echo "</td></tr>"; } echo "</table>"; if ($startrow > 1) { $prevrow = $startrow - $display; echo '<a href="testing2.php?startrow=$prevrow">Previous</a> '; } $pages = intval($count / $display); if ($count % $display) { $pages++; } if ($pages > 1) { for ($i=1; $i <= $pages; $i++) { $next = $display * ($i - 1); echo '<a href="testing2.php?startrow=$next">$i</a> '; } } if (!(($startrow / $display) == $pages) && $pages != 1) { $next = $startrow + $display; echo '<a href="testing2.php?startrow=$next">Next</a> '; } if ($count < 1) { echo "Nothing, sorry. Please try again."; } ?>
-
move up to a deluxe hosting account if you can, that is what I did. Usually does not cost that much more.
-
I suppose without seeing the class, I will not be able to learn much from that example, right?
-
I hope I'm allowed to post links http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23060532.html?eeSearch=true If you look at the very last reply all the way at the bottom of the page, this is what I'm looking to do.
-
The $_GET['p'] , is that just a session variable that was set? I found this on google and wanted to use something similar for my pagination <?php $pager = new pager($_GET['p'], $records_per_page, $total_count, $number_of_links); ?> When I try to use it with my code, it is saying that "class pager not found"
-
alright, i threw some info into the query to make sure it works and it does. So I'll go back and check my variables.
-
if ($result = mysql_query($sql)) = nothing displayed and if (mysql_num_rows($sql) > 0) = nothing displayed
-
Here is my table the is suppose to be displayed. But is not. No table is displayed and also in the error console of FF I get an "unterminated string literal" which points to this below. image0.src ="<?php echo $row['imgpath']; ?>" image1.src ="<?php echo $row['imgpath2']; ?>" image2.src ="<?php echo $row['imgpath3']; ?>" image3.src ="<?php echo $row['imgpath4']; ?>" image4.src ="<?php echo $row['imgpath5']; ?>" <?php include "connection.php"; $sql = mysql_query("SELECT id, imgpath, imgpath2, imgpath3, imgpath4, imgpath5, thumb_1, thumb_2, thumb_3, thumb_4, thumb_5 FROM member_pictures WHERE thumb_1 = " . $_SESSION['picposted'] . ""); $result=mysql_query($sql); if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $row = mysql_fetch_array($result); ?> <table width="705" bordercolor="#000000" bgcolor="#9AA4AD" id="table"> <tr> <td> <table width="400" border="1" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td colspan="4"><div align="center"><img src="<?php echo $row['imgpath']; ?>" align="middle" border="0" width="380 height="225" name="large"></div></td> </tr> <tr> <td colspan="4"> <div align="center"> Mouse over thumbnails to view larger image. </div> </td> </tr> <tr> <td bordercolor="#FFFFFF"> <div align="center"> <a onmouseover="javascript:image_click(0)"><img src="<?php echo $row['thumb_1']; ?>" width="90" height="80" name="pimage0" border=0></a> </div> </td> <td bordercolor="#FFFFFF"> <div align="center"> <a onmouseover="javascript:image_click(1)"><img src="<?php echo $row['thumb_2']; ?>" width="90" height="80" name="pimage1" border=0></a> </div> </td> <td bordercolor="#FFFFFF"> <div align="center"> <a onmouseover="javascript:image_click(2)"><img src="<?php echo $row['thumb_3']; ?>" width="90" height="80" name="pimage2" border=0></a> </div> </td> <td bordercolor="#FFFFFF"> <div align="center"> <a onmouseover="javascript:image_click(3)"><img src="<?php echo $row['thumb_4']; ?>" width="90" height="80" name="pimage3" border=0></a> </div> </td> <td bordercolor="#FFFFFF"> <div align="center"> <a onmouseover="javascript:image_click(4)"><img src="<?php echo $row['thumb_5']; ?>" width="90" height="80" name="pimage4" border=0></a> </div> </td> </tr> </table> <?php } } ?> </td> </tr> </table> </div> </div> </div> </td> </tr> </table> I'm pretty sure that I am displaying the table correctly. I have done this before. Maybe something is wrong though. I'm stumped.
-
Nope, totally confused now. And wondering if the general way I have the code will even work at all, or if I should change everything.
-
got it. I think. I try a few things.
-
Actually, just the part where you say that the rest of the code goes here. I'm sorry, I'm not just looking for someone to give me the answer. I would still like to understand it.
-
wo, what? sorry.
-
just changed it whle you were probably typing changed $result=mysql_query($sql); to this $row = mysql_fetch_array($sql) Now this. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource One day I think i understand it, next day I'm confused