Jeg har en database mysql med 3 felter id spillested og dato, og ønsker at den viser spille jobbene efter dato og når jeg tilføjer et nyt job hopper det automatisk ind på plads hvor det passer med dato. det vil sige at hvis jeg tilføjer datoen 02 - 01 - 2007 og der allerede er en dato der hedder 01 - 01 - 2007 så ligger indlæget sig automatisk før den dato der er ældre og omvendt...
her er det jeg har lavet men det sorterer ikke rigtigt??? please help me...
<?php require_once('Connections/cms.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_rsKoncerter = 5;
$pageNum_rsKoncerter = 0;
if (isset($_GET['pageNum_rsKoncerter'])) {
$pageNum_rsKoncerter = $_GET['pageNum_rsKoncerter'];
}
$startRow_rsKoncerter = $pageNum_rsKoncerter * $maxRows_rsKoncerter;
mysql_select_db($database_cms, $cms);
$query_rsKoncerter = "SELECT *,date_format(dato, '%d-%m-%Y') AS dato FROM koncerter ORDER BY dato DESC";
$query_limit_rsKoncerter = sprintf("%s LIMIT %d, %d", $query_rsKoncerter, $startRow_rsKoncerter, $maxRows_rsKoncerter);
$rsKoncerter = mysql_query($query_limit_rsKoncerter, $cms) or die(mysql_error());
$row_rsKoncerter = mysql_fetch_assoc($rsKoncerter);
if (isset($_GET['totalRows_rsKoncerter'])) {
$totalRows_rsKoncerter = $_GET['totalRows_rsKoncerter'];
} else {
$all_rsKoncerter = mysql_query($query_rsKoncerter);
$totalRows_rsKoncerter = mysql_num_rows($all_rsKoncerter);
}
$totalPages_rsKoncerter = ceil($totalRows_rsKoncerter/$maxRows_rsKoncerter)-1;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Højre hånd først</title>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
.style4 {font-size: 10px}
.style7 {font-size: 25px}
.style8 {
font-size: 11px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<table width="650" border="0" align="center" cellpadding="0" cellspacing="0" class="layout">
<tr>
<td align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="80"> </td>
<td height="80" align="left"><span class="style7">HØJRE HÅND FØRST <br />
</span>100% DE BEDSTE HITS </td>
<td height="80"> </td>
</tr>
<tr>
<td width="25%" align="center"><table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="#">Bandet</a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><a href="#">Nyheder</a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><a href="#">Galleri</a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><a href="#">Gæstebog</a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><a href="#">Koncerter</a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><a href="#">Kontakt & Booking </a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><a href="#">Musik</a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><a href="#">Presse</a></td>
</tr>
</table></td>
<td width="389" height="300" align="center" valign="top"><script type="text/javascript">
AC_FL_RunContent( 'codebase','
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','389','height','300','title','HHF','src','images/main','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','wmode','transparent','movie','images/main' ); //end AC code
</script>
<noscript>
<object classid="clsid
27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="389" height="300" title="HHF">
<param name="movie" value="images/main.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="images/main.swf" width="389" height="300" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>
</object>
</noscript></td>
<td width="25%" align="center" valign="top"><table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><span class="style8">Kommende koncerter </span></td>
</tr>
<tr>
<td height="77" align="center" valign="top"><?php do { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td><span class="style4"><strong><?php echo $row_rsKoncerter['spillested']; ?></strong></span></td>
</tr>
<tr>
<td><?php echo $row_rsKoncerter['dato']; ?></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<?php } while ($row_rsKoncerter = mysql_fetch_assoc($rsKoncerter)); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td align="right"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><p align="left">fdsdsdfsdf<br />
<br />
sfsdfsdf<br />
fsdssdfsfsdfsdfdsfsdfsdfsf</p>
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><p> </p> </td>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="27" align="center"> </td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($rsKoncerter);
?>