Jump to content

Combination scripts MySQL


svdb

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...