Datum omzetten
Is er misschien iemand die mij verder kan helpen
Hier het script:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?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;
}
}
mysql_select_db($database_horeca_alkmaar, $horeca_alkmaar);
$query_januari = "SELECT artiest, datum, aanvang, locatie FROM evenement ORDER BY datum ASC";
$januari = mysql_query($query_januari, $horeca_alkmaar) or die(mysql_error());
$row_januari = mysql_fetch_assoc($januari);
$totalRows_januari = mysql_num_rows($januari);
?>
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;
}
}
mysql_select_db($database_horeca_alkmaar, $horeca_alkmaar);
$query_januari = "SELECT artiest, datum, aanvang, locatie FROM evenement ORDER BY datum ASC";
$januari = mysql_query($query_januari, $horeca_alkmaar) or die(mysql_error());
$row_januari = mysql_fetch_assoc($januari);
$totalRows_januari = mysql_num_rows($januari);
?>
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Evenementen</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
margin: 0px;
padding: 0px;
background-attachment: fixed;
background-image: url(../images/torenrechtsonder.jpg);
background-repeat: no-repeat;
background-position: left top;
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
color: #000000;
}
}
.maandtabel {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #000000;
}
-->
</style>
<link href="../css/tabel.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="756" border="0">
<tr>
<td width="750" valign="top"><br />
<div align="right">
<p> </p>
<table width="600" border="0" cellspacing="4">
<tr class="maandtabel">
<td><div align="center">Evenementen 2008</div></td>
</tr>
</table>
<table border="0">
<tr>
<td><table width="600" border="0" cellspacing="4" class="tabel">
<tr>
<td width="120"><div align="left">datum: </div></td>
<td width="55"><div align="left">Locatie: </div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<td><div align="left">aanvang: </div></td>
<td width="55"><div align="left">Artiest(en):</div></td>
<td><div align="left"></div></td>
</tr>
</table></td>
Code (php)
</tr>
</table>
</div></td>
</tr>
</table>
</body>
</html>
SELECT artiest, datum, aanvang, locatie FROM evenement ORDER BY datum ASC
Meot worden
SELECT artiest, DATE_FORMAT(datum,'d-m-Y') AS datum, aanvang, locatie FROM evenement ORDER BY datum ASC
Dan hoef je je script verder niet aan te passen.
Succes dr mee
Een alias geef je altijd een andere naam wanneer deze andere content bevat, het is tenslotte wat anders:
DATE_FORMAT(datum,'%d-%m-%Y') AS datum_nl
Ja ok goed punt.
Waar zet ik date_format neer en echo ik 'datum_nl'
alvast bedankt
hier het script:
Code (php)
1
2
3
4
5
6
7
2
3
4
5
6
7
<?php
mysql_select_db($database_horeca_alkmaar, $horeca_alkmaar);
$query_januari = "SELECT artiest, DATE_FORMAT(datum,'%d-%m-%Y') AS datum_nl, aanvang, locatie FROM evenement ORDER BY datum ASC";
$januari = mysql_query($query_januari, $horeca_alkmaar) or die(mysql_error());
$row_januari = mysql_fetch_assoc($januari);
$totalRows_januari = mysql_num_rows($januari);
?>
mysql_select_db($database_horeca_alkmaar, $horeca_alkmaar);
$query_januari = "SELECT artiest, DATE_FORMAT(datum,'%d-%m-%Y') AS datum_nl, aanvang, locatie FROM evenement ORDER BY datum ASC";
$januari = mysql_query($query_januari, $horeca_alkmaar) or die(mysql_error());
$row_januari = mysql_fetch_assoc($januari);
$totalRows_januari = mysql_num_rows($januari);
?>
Sorry foutje van mij maar het werkt super bedankt allemaal