Jump to content
php.lv forumi

izvadiisana


fantomas

Recommended Posts

nop diezvai sakars shoreiz ir ar to!

 

for($row = 0; $row < $_SESSION['Flashgames']['perPage']/3; $row++) shis ir nedaudz japārveido lai tas sanaaktu. es iisti neizprotu logiku kur!!!

 

 

for($row = 0; $row > $_SESSION['Flashgames']['perPage']/3; $row++) nesanaak

 

 

for($row = 0; $row > $_SESSION['Flashgames']['perPage']/3; $row--) arii nesanaak!

 

 

tad kaa iiisti japaarveido shis for($row = 0; $row < $_SESSION['Flashgames']['perPage']/3; $row++) lai panaaktu nevis dilstoshu bet augoshu seciibu!?

Link to comment
Share on other sites

bet ja jau taa. tad kaa man buutu jaizmaina query

 

$result = mysql_query('select * from flashgames limit '.(((int)$page-1)*(int)$_SESSION['Flashgames']['perPage']).','. (int)$_SESSION['Flashgames']['perPage']) or die('sql error: ' . mysql_error());
	while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
		$gamesList[] = $line;

	return array('games' => $gamesList, 'page' => $page, 'recordCount' => $cnt, 'pageCount' => ceil($cnt / $_SESSION['Flashgames']['perPage']));
}

Link to comment
Share on other sites

atvainojos. es pievienoju nepareizo kodu!

 

public function getGame($id) {
	if(!is_numeric($id) || round($id) != $id) die(he he he:<b>"'.$id.'"</b>');
	self::connect();
	$result = mysql_query('select * from flashgames where id="'.$id.'" limit 1') or die('sql error: ' . mysql_error());
	return mysql_fetch_array($result, MYSQL_ASSOC);
}

Link to comment
Share on other sites

fantomas ----> mby tā

public function getGame($id) {
	if(!is_numeric($id) || round($id) != $id) die(he he he:<b>"'.$id.'"</b>');
	self::connect();
	$result = mysql_query('select * from flashgames where id="'.$id.'" order by DESC limit 1') or die('sql error: ' . mysql_error());
	return mysql_fetch_array($result, MYSQL_ASSOC);
}

Link to comment
Share on other sites

vispār tev tur kautkas kreis, kapēc vnk nedarīt tā : (?)

$sql="SELECT * FROM `flashgames` ORDER BY id DESC";
$res=mysql_query($sql);
while($row=mysql_fetch_object($res))
{
 echo $row->blablabla."<br />..."; // utt
}

 

vai arī, no kurienes tu tos id izrauj? ja tu selektē vienu ierakstu, tad nemaz nav iespējams to izvadīt pēc lielāka/mazākā id

Link to comment
Share on other sites

×
×
  • Create New...