NorthWind Posted May 19, 2006 Share Posted May 19, 2006 [code]<?php echo "<table align='center' border='0' cellpadding='6' cellspacing='3'>"; echo "<td height='406' valign='center' align='center'>"; require_once("config.php"); $cname = $_POST['cname']; $sno = $_POST['sno']; $tref = $_POST['tref']; $accno = $_POST['accno']; $service = $_POST['service']; $speed = $_POST['speed']; $data = $_POST['data']; $rdate = $_POST['realDate']; $owed = $_POST['owed']; $paid = $_POST['paid']; $querycnt = "SELECT * from telstra"; $resultcnt = mssql_query($querycnt, $link); $num_itemscnt = mssql_num_rows($resultcnt); if ($num_itemscnt <= 0) { $num_itemscnt=1;} else {$num_itemscnt++;} //$rdate2='20/05/2006'; $query = "INSERT INTO telstra (id, custname, servno, telstraref, accno, service, speed, data, datesubmit, cown, cpaid) VALUES ('$num_itemscnt', '$cname', '$sno', '$tref', '$accno', '$service', '$speed', '$data', '$rdate', '$owed', '$paid')"; $result = mssql_query($query, $link); if ($result) { echo $rdate; echo "<h3>Success ! \n"; echo "<p>$cname has been added to the database."; echo "<p><a href='telstra_list.php'>List All Customers' Subscriptions </a> \n"; } else { echo "<h2>error with database! - Customer May Already Exist"; } echo "</td>"; echo "</table>"; ?>[/code]i got some stuff from the previous page with post, then enter em to the db. the problem is the datefield does not get written to the db. I echo it too to check i get it or not, it gets it ok and shows 19/05/2006 but when i check the db, i c <NULL>.the db field for date is datetime with 8 lenght and allow nulls.any ideas guys? thanks Link to comment https://forums.phpfreaks.com/topic/9968-date-field-doesnt-work/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.