Jump to content

date field doesnt work


NorthWind

Recommended Posts

[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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.