Ik heb deze query

SELECT *
FROM upcomingwars
ORDER BY upcomingwars.datum, upcomingwars.tijd_uur DESC, upcomingwars.tijd_minuut

zoals je ziet sorteert hij deze op de datum daarna op de tijd in uren en daarna in minuten.

Nu wil ik dat hij de 8ste datum pakt uit de tabel upcomingwars hoe doe ik dat?

het is namelijk voor website de eerste 7 waardes uit de tabel krijgen een andere class mee dan de 8ste waarde uit een tabel

de hele code:

  <?php $counter = 0; // initialize counter outside loop ?>
  <?php do { ?>
<?php
    // VLAGGEN
	if ($row_getUpcomingwars['land'] == "nl"){
	$row_getUpcomingwars['land'] = "<img src=\"images/flags/flag-nl.gif\" width=\"16\" height=\"11\" alt=\"flag-nl\" />";
	}
							
	if ($row_getUpcomingwars['land'] == "be"){
	$row_getUpcomingwars['land'] = "<img src=\"images/flags/flag-be.gif\" width=\"16\" height=\"11\" alt=\"flag-be\" />";
	}
						
	if ($row_getUpcomingwars['land'] == "de"){
	$row_getUpcomingwars['land'] = "<img src=\"images/flags/flag-de.gif\" width=\"16\" height=\"11\" alt=\"flag-de\" />";
	}
							
	if ($row_getUpcomingwars['land'] == "fi"){
	$row_getUpcomingwars['land'] = "<img src=\"images/flags/flag-fi.gif\" width=\"16\" height=\"11\" alt=\"flag-fi\" />";
	}
							
	if ($row_getUpcomingwars['land'] == "se"){
	$row_getUpcomingwars['land'] = "<img src=\"images/flags/flag-se.gif\" width=\"16\" height=\"11\" alt=\"flag-fi\" />";
	}
							
	if ($row_getUpcomingwars['land'] == "pl"){
	$row_getUpcomingwars['land'] = "<img src=\"images/flags/flag-pl.gif\" width=\"16\" height=\"11\" alt=\"flag-pl\" />";
	}
	// EIND VLAGGEN
	// GAME ICONS
	if ($row_getUpcomingwars['game'] == 1){
	$row_getUpcomingwars['game'] = "<img src=\"images/games/icon-cs.gif\" width=\"16\" height=\"11\" alt=\"icon-cs\" />";
	}
	if ($row_getUpcomingwars['game'] == 2){
	$row_getUpcomingwars['game'] = "<img src=\"images/games/icon-css.gif\" width=\"16\" height=\"11\" alt=\"icon-css\" />";
	}
	if ($row_getUpcomingwars['game'] == 3){
	$row_getUpcomingwars['game'] = "<img src=\"images/games/icon-to.gif\" width=\"16\" height=\"11\" alt=\"icon-to\" />";
	}
	if ($row_getUpcomingwars['game'] == 4){
	$row_getUpcomingwars['game'] = "<img src=\"images/games/icon-toc.gif\" width=\"16\" height=\"11\" alt=\"icon-toc\" />";
	}
	if ($row_getUpcomingwars['game'] == 5){
	$row_getUpcomingwars['game'] = "<img src=\"images/games/icon-ut.gif\" width=\"16\" height=\"11\" alt=\"icon-ut\" />";
	}
	if ($row_getUpcomingwars['game'] == 6){
	$row_getUpcomingwars['game'] = "<img src=\"images/games/icon-ut2k4.gif\" width=\"16\" height=\"11\" alt=\"icon-ut2k4\" />";
	}
	// EIND GAME ICONS
	?>	
         <tr height="18"  <?php if ($counter++ %2)  {	  echo 'class="warlicht"';	  }   ?> >
    	   
    	     <td width="20" align="center" valign="middle" class="icon"><?php echo $row_getUpcomingwars['game']; ?></td>
    	     <td width="26" align="center" valign="middle" class="country"><?php echo $row_getUpcomingwars['land']; ?></td>
    	     <td width="125" align="left" valign="middle" class="clan"><?php echo $row_getUpcomingwars['clan']; ?></td>
    	     <td width="38" align="center" valign="middle" class="upcomming"><?php echo $row_getUpcomingwars['score']; ?></td>
    	     </tr>
		<?php } while ($row_getUpcomingwars = mysql_fetch_assoc($getUpcomingwars)); ?>	
	    <tr height="17" class="lastwarlicht">
    <?php do {
	// VLAGGEN
	if ($row_getRow8Upcomingwars['land'] == "nl"){
	$row_getRow8Upcomingwars['land'] = "<img src=\"images/flags/flag-nl.gif\" width=\"16\" height=\"11\" alt=\"flag-nl\" />";
	}
							
	if ($row_getRow8Upcomingwars['land'] == "be"){
	$row_getRow8Upcomingwars['land'] = "<img src=\"images/flags/flag-be.gif\" width=\"16\" height=\"11\" alt=\"flag-be\" />";
	}
						
	if ($row_getRow8Upcomingwars['land'] == "de"){
	$row_getRow8Upcomingwars['land'] = "<img src=\"images/flags/flag-de.gif\" width=\"16\" height=\"11\" alt=\"flag-de\" />";
	}
							
	if ($row_getRow8Upcomingwars['land'] == "fi"){
	$row_getRow8Upcomingwars['land'] = "<img src=\"images/flags/flag-fi.gif\" width=\"16\" height=\"11\" alt=\"flag-fi\" />";
	}
							
	if ($row_getRow8Upcomingwars['land'] == "se"){
	$row_getRow8Upcomingwars['land'] = "<img src=\"images/flags/flag-se.gif\" width=\"16\" height=\"11\" alt=\"flag-fi\" />";
	}
							
	if ($row_getRow8Upcomingwars['land'] == "pl"){
	$row_getRow8Upcomingwars['land'] = "<img src=\"images/flags/flag-pl.gif\" width=\"16\" height=\"11\" alt=\"flag-pl\" />";
	}
	// EIND VLAGGEN
	// GAME ICONS
	if ($row_getRow8Upcomingwars['game'] == 1){
	$row_getRow8Upcomingwars['game'] = "<img src=\"images/games/icon-cs.gif\" width=\"16\" height=\"11\" alt=\"icon-cs\" />";
	}
	if ($row_getRow8Upcomingwars['game'] == 2){
	$row_getRow8Upcomingwars['game'] = "<img src=\"images/games/icon-css.gif\" width=\"16\" height=\"11\" alt=\"icon-css\" />";
	}
	if ($row_getRow8Upcomingwars['game'] == 3){
	$row_getRow8Upcomingwars['game'] = "<img src=\"images/games/icon-to.gif\" width=\"16\" height=\"11\" alt=\"icon-to\" />";
	}
	if ($row_getRow8Upcomingwars['game'] == 4){
	$row_getRow8Upcomingwars['game'] = "<img src=\"images/games/icon-toc.gif\" width=\"16\" height=\"11\" alt=\"icon-toc\" />";
	}
	if ($row_getRow8Upcomingwars['game'] == 5){
	$row_getRow8Upcomingwars['game'] = "<img src=\"images/games/icon-ut.gif\" width=\"16\" height=\"11\" alt=\"icon-ut\" />";
	}
	if ($row_getRow8Upcomingwars['game'] == 6){
	$row_getRow8Upcomingwars['game'] = "<img src=\"images/games/icon-ut2k4.gif\" width=\"16\" height=\"11\" alt=\"icon-ut2k4\" />";
	}
	// EIND GAME ICONS		   
		    ?>
             <td width="20" align="center" valign="middle" class="lasticon"><?php echo $row_getRow8Upcomingwars['game']; ?></td>
             <td width="26" align="center" valign="middle" class="lastcountry"><?php echo $row_getRow8Upcomingwars['land']; ?></td>
             <td width="125" align="left" valign="middle" class="lastclan"><?php echo $row_getRow8Upcomingwars['clan']; ?></td>
             <td width="38" align="center" valign="middle" class="lastupcomming"><?php echo $row_getRow8Upcomingwars['score']; ?>		</td>
             <?php } while ($row_getRow8Upcomingwars = mysql_fetch_assoc($getRow8Upcomingwars)); ?></tr>

	
         </table>
LIMIT 7,8 aan het eind van je query toevoegen
Als ik limit7,8 doe en dan op test in dreamweaver krijg ik de goede record, maar als ik hem dan lokaal test krijg ik deze error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 1' at line 1

dit is de hele query

mysql_select_db($database_allstars, $allstars);
$query_getRow8Upcomingwars = "SELECT * FROM upcomingwars ORDER BY upcomingwars.datum, upcomingwars.tijd_uur DESC, upcomingwars.tijd_minuut LIMIT 7,8";
$query_limit_getRow8Upcomingwars = sprintf("%s LIMIT %d, %d", $query_getRow8Upcomingwars, $startRow_getRow8Upcomingwars, $maxRows_getRow8Upcomingwars);
$getRow8Upcomingwars = mysql_query($query_limit_getRow8Upcomingwars, $allstars) or die(mysql_error());
$row_getRow8Upcomingwars = mysql_fetch_assoc($getRow8Upcomingwars);

if (isset($_GET['totalRows_getRow8Upcomingwars'])) {
  $totalRows_getRow8Upcomingwars = $_GET['totalRows_getRow8Upcomingwars'];
} else {
  $all_getRow8Upcomingwars = mysql_query($query_getRow8Upcomingwars);
  $totalRows_getRow8Upcomingwars = mysql_num_rows($all_getRow8Upcomingwars);
}
$totalPages_getRow8Upcomingwars = ceil($totalRows_getRow8Upcomingwars/$maxRows_getRow8Upcomingwars)-1;
al opgelost bedankt voor dat limit 7,8 werkt nu wel
LIMIT 7, 8 zal regel 8 t-m 15 terug geven, denk dat je LIMIT 7, 1 nodig hebt.

Reageren