DATE function trubble!!!!
Posted: Thu Jun 13, 2002 1:24 pm
I have some problems with my date function... this is the mess I get!
plz help me.... fustration kid![/b]
this is the code!Notice: Undefined index: date in D:\webb\crookz\news\newsupdate.php on line 37
Notice: Undefined variable: date in D:\webb\crookz\news\newsupdate.php on line 68
Code: Select all
<link rel="stylesheet" href="../css/tabel.css" type="text/css">
<link rel="stylesheet" href="../css/link.css" type="text/css">
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#CCCCCC">
<table width="100%" border="0">
<tr>
<td height="19"><a href="formnews.php">add more news---></a></td>
</tr>
<tr>
<td>
<div align="right"><a href="news.php"><---back to main</a></div>
</td>
</tr>
</table>
<?php
$username= "root";
$password= "hg";
$db= "News";
$title= $_POSTї'title'];
$summary= $_POSTї'summary'];
$author= $_POSTї'author'];
$story= $_POSTї'story'];
$date_added= $_POSTї'date'];
function make_datetime_pretty($date) {
$break = explode(" ", $date);
$datebreak = explode("-", $breakї0]);
$time = explode(":", $breakї1]);
$datetime = date("F j, Y - g:i A", mktime($timeї0],$timeї1],$timeї2],$datebreakї1],$datebreakї2],$datebreakї0]));
return $datetime;
}
$link = mysql_connect( "localhost", $username, $password )
or die("unable to connect to mysql server: ".mysql_error());
mysql_select_db($db,$link)
or die("unable to select database 'db': ".mysql_error());
$result = mysql_query("INSERT INTO crookznews(Title ,Summary, Author ,Story ,date_added) values ('$title','$summary', '$author', '$story', '$date')", $link);
if (!$result) {
die("query failed: ".mysql_error());
}
?>