jsmknow Posted December 14, 2008 Share Posted December 14, 2008 Hi all.. I have a search form on my website, where you can search for members on my page. On that page i have a working "count++" where it shows 10 results each page. Now i have the problem, i have a page that you can access when you are logged in, where you can see all members on the page, but i cant get the "count++" to work on that page. I really need help.. can any help me? maybe even update my code.. <? $*****=($_POST[*****]); echo "<body style='color: #000000; background-color: #FFFFFF; background-image: url(../images/$*****-bag.jpg)'>"; ?> <?php $con = mysql_connect("*****","*****","*****"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("*****", $con); ?> <head> <link rel="stylesheet" type="text/css" href="style.css"> <style type="text/css"> .style1 { color: #FFFFFF; font-size: medium; } .style2 { border: 3px solid #814D1D; background-color: #C47E35; } .style30 { border: 3px solid #82C03D; margin-top: 0px; } .style31 { text-align: center; } .style32 { border-style: none; border-width: 0; margin-top: 0px; } </style> </head> <table align="center" width="400px" class="style32"> <tr> <td class="style31"><strong>Andre Brugere På JSMknow Own:</strong></td> </tr> </table> <table class="style30" align="center" style="width: 450px"> <tr> <td> <?php $*****= $_POST[*****]; $hent = mysql_query("SELECT * FROM ***** WHERE user!='$*****' ORDER BY online DESC"); if(mysql_num_rows($hent)) { while ($vis = mysql_fetch_array($hent)) { if (($vis[online]=='online')) { $online="<img src='../images/online.png' width='15' height='15' alt='Online'>"; } else { $online="<img src='../images/offline.png' width='15' height='15' alt='Offline'>"; } if (file_exists("../images/$vis[user].jpg")) { $img = "../images/$vis[user].jpg"; } else { $img = "../images/nopic.jpg"; } echo "<center>" . $online . "" . $vis['user'] . "<form class='form' method='post' action='profile.php?user=$vis[user]' target='Indhold' style='width: 200px'><input type='hidden' name='afsender' value='*****'><input name='jsmknow' type='submit' height='100px' width='100px' value='$vis[user]' alt='Se $vis[user]s Profil'></form></center>"; $count++; if ($count % 8 == 0) { echo "</td><td>"; } } } ?> </td> </tr> </table> <? mysql_close($con); ?> Link to comment https://forums.phpfreaks.com/topic/136952-need-help-with-count/ Share on other sites More sharing options...
wildteen88 Posted December 14, 2008 Share Posted December 14, 2008 You'll need to initiate $count outside of your while loop: f(mysql_num_rows($hent)) { $count = 0; // initiate counter while ($vis = mysql_fetch_array($hent)) { Link to comment https://forums.phpfreaks.com/topic/136952-need-help-with-count/#findComment-715260 Share on other sites More sharing options...
jsmknow Posted December 14, 2008 Author Share Posted December 14, 2008 then i have to move this? I want it to make a link to next page after 10 members.. $count++; if ($count % 8 == 0) { echo "</td><td>"; } Link to comment https://forums.phpfreaks.com/topic/136952-need-help-with-count/#findComment-715263 Share on other sites More sharing options...
wildteen88 Posted December 14, 2008 Share Posted December 14, 2008 You'll have to look into some pagination tutorials for that. Link to comment https://forums.phpfreaks.com/topic/136952-need-help-with-count/#findComment-715278 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.