fantomas Posted December 23, 2007 Report Share Posted December 23, 2007 kaa ir jauzraksta. lai panaaktu darbiibu preteejaa virzienaaa!!! jeb shobriid man datubaaazes jaunaakos ierakstus izvada kaa peedeejos.. faktiski ir japanaak lai izvadiitu jaunos kaa pirmos!!!??? http://paste.php.lv/6638 Link to comment Share on other sites More sharing options...
martins256 Posted December 23, 2007 Report Share Posted December 23, 2007 a kā tu iegusti sarakstu ar tiem flash geimiem ? Ja no kkādas datubāzes velc, tad jau vnk jānorāda order by... Link to comment Share on other sites More sharing options...
fantomas Posted December 23, 2007 Author Report Share Posted December 23, 2007 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 More sharing options...
4e4en Posted December 23, 2007 Report Share Posted December 23, 2007 Primkārt šitais būtu jārisina izmainot MySQL queriju, bet ja tu tik ļoti gribi čerez žopu risinājumu tad lūdzu for($row = $_SESSION['Flashgames']['perPage']/3; $row >= 0; $row--) Link to comment Share on other sites More sharing options...
fantomas Posted December 23, 2007 Author Report Share Posted December 23, 2007 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 More sharing options...
fantomas Posted December 23, 2007 Author Report Share Posted December 23, 2007 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 More sharing options...
p4F Posted December 23, 2007 Report Share Posted December 23, 2007 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 More sharing options...
fantomas Posted December 23, 2007 Author Report Share Posted December 23, 2007 nop ar sho izmainju nebija. taads pats rezuultaats :) Link to comment Share on other sites More sharing options...
marcis Posted December 23, 2007 Report Share Posted December 23, 2007 p4f, laikam visiem tas nav pats par sevi skaidrs "order by DESC" --> "order by id DESC" Link to comment Share on other sites More sharing options...
marcis Posted December 23, 2007 Report Share Posted December 23, 2007 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 More sharing options...
Recommended Posts