Duuminjsh Posted September 28, 2009 Report Share Posted September 28, 2009 Man te ir uzdevums: nedaudz piestrādāt pie vienas web lapas.. Problēma: tabula "jaunumi", parāda tikai pēdējo ierakstu, precīzāk pēdējo/augstāko vērtību no lauka npk (numurs pēc kārtas), ja es nomainu kādam ierakstam 'npk', tas ieraksts automātiski aizvieto iepriekšējo.. kods: <?php $maxnpk = "SELECT MAX(npk) FROM jaunumi"; $maxnpkresult = mysql_query($maxnpk) or die(mysql_error()); while($maxrow = mysql_fetch_array($maxnpkresult)){ $npk = $maxrow['MAX(npk)']; } $virtex="select * from jaunumi where npk='$npk'"; $virtexres2=mysql_query($virtex) or die(mysql_error()); while($row = mysql_fetch_array($virtexres2)){ echo "<br />" . $row['date']; ?> <center class="tab3"><strong> <?php echo $row['virs'] . "</strong></center><br />" . $row['text'] . "<br />"; if ($row['url1']) { ?> mjā.. ceru uz palīdzību.. Quote Link to comment Share on other sites More sharing options...
briedis Posted September 28, 2009 Report Share Posted September 28, 2009 A ko īsti gribi panākt? Un iekļauj, lūdzu, kodu code tagos, citādi grūti pārskatāms :( Quote Link to comment Share on other sites More sharing options...
Duuminjsh Posted September 28, 2009 Author Report Share Posted September 28, 2009 gribu panākt, lai tiek parādīti visi ieraksti no tabulas.. Quote Link to comment Share on other sites More sharing options...
marcis Posted September 28, 2009 Report Share Posted September 28, 2009 (edited) Nesapratu, kas nav skaidrs vai kur vispār ir problēma... P.S. To ko tu esi uzrakstījis, var uzrakstīt šādi: $row = mysql_fetch_assoc(mysql_query("SELECT * FROM `jaunumi` ORDER BY npk DESC LIMIT 1")); print_r($row); EDIT: Ak visus gribi... Skaties piemērus šeit. Edited September 28, 2009 by marcis Quote Link to comment Share on other sites More sharing options...
briedis Posted September 28, 2009 Report Share Posted September 28, 2009 <?php $virtex="select * from jaunumi"; $virtexres2=mysql_query($virtex) or die(mysql_error()); while($row = mysql_fetch_array($virtexres2)){ echo "<br />" . $row['date']; ?> <center class="tab3"><strong> <?php echo $row['virs'] . "</strong></center><br />" . $row['text'] . "<br />"; if ($row['url1']) { ?> Quote Link to comment Share on other sites More sharing options...
Duuminjsh Posted September 29, 2009 Author Report Share Posted September 29, 2009 milzīgs paldies Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.