svdb Posted April 7, 2010 Share Posted April 7, 2010 Hi, I've combined two scripts and I think they might not work together. I think they fail because I've two different mysql_fetch_assoc() <?phpinclude('config.php')$q = "SELECT * FROM entries ORDER BY votes_up DESC";$r = mysql_query($q);if(mysql_num_rows($r)>0): while($row = mysql_fetch_assoc($r)): $net_vote = $row['votes_up'] - $row['votes_down']; $votes_down = $row['votes_down']; $votes_up = $row['votes_up']; include_once('ps_pagination.php'); $pager = new PS_Pagination($link, $q, 10, 5, ""); $pager->setDebug(true); $rs = $pager->paginate(); if(!$rs) die(mysql_error()); while($row = mysql_fetch_assoc($rs)) { echo //some html with the variables Is there a way to make this work properly??? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 7, 2010 Share Posted April 7, 2010 You can use mysql_data_seek to reset the pointer for a result:http://www.php.net/manual/en/function.mysql-data-seek.php Link to comment Share on other sites More sharing options...
svdb Posted April 8, 2010 Author Share Posted April 8, 2010 I tried some stuff with mysql_data_seek, but I'm new to php so I'm not sure what to change /add in my script Link to comment Share on other sites More sharing options...
justsomeguy Posted April 8, 2010 Share Posted April 8, 2010 Read the description for mysql_fetch_assoc:http://www.php.net/manual/en/function.mysql-fetch-assoc.phpIt talks about moving the data pointer forward. The data pointer indicates which record to return the next time you use that function. If you want to go back to the first record in the set, then you use mysql_data_seek to reset the pointer. A position of 0 will put it back at the first record. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.