IBEX Posted November 3, 2008 Report Share Posted November 3, 2008 (edited) <?php $result = mysql_query("SELECT * FROM video ORDER BY video_id DESC LIMIT 2"); $result = mysql_fetch_array($result); echo '<BR><b>Newsest video - </b>'.$result['name'].''; $result = mysql_query("SELECT * FROM `video` ORDER BY RAND() limit 2"); $result = mysql_fetch_array($result); echo '<BR><b>Random Video - </b>'.$result['name'].''; ?> Limits ir 2, bet rādās tikai 1.. :/ why? itkā viss ir pareizi..!? Edited November 3, 2008 by IBEX Link to comment Share on other sites More sharing options...
andrisp Posted November 3, 2008 Report Share Posted November 3, 2008 Tāpēc, ka nepareizi dari. Tev ir jāciklē cauri rezultsetam. Paskaties manuāli pie mysql_fetch_array() un uzreiz sapratīsi. PS. CODE tagu, lūdzu! Link to comment Share on other sites More sharing options...
e-remit Posted November 3, 2008 Report Share Posted November 3, 2008 Izkopēts no http://lv.php.net/manual/en/function.mysql-fetch-array.php $result = mysql_query("SELECT id, name FROM mytable"); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { printf("ID: %s Name: %s", $row[0], $row[1]); } Kaut ko neaizmirsi? Link to comment Share on other sites More sharing options...
Recommended Posts