0

Hi ,

i am using mssql. I had a field with datatype datetime.

My php coding:
            $requested=date("d/m/y : H:i:s", time()); 
             i am using this query 

            insert into tbl values('$requested')

while inserting into my mssql table, i am facing the following error
Warning: mssql_query() [function.mssql-query]: message: Syntax error converting datetime from character string. (severity 16) in C:\xampp\htdocs\form.php on line 176

Warning: mssql_query() [function.mssql-query]: Query failed in C:\xampp\htdocs\form.php on line 176
unable to insert into log table

please help me out. thanks

3
Contributors
3
Replies
6
Views
6 Years
Discussion Span
Last Post by vibhaJ
0

I think if you are inserting into all the columns, you only need

insert into tbl ('$requested')

otherwise, you should specify the columns

insert into tbl ('columns') values ('$requested')

not exactly sure.

0

You don't require : between date and time.
i.e $requested=date("d/m/y : H:i:s", time());
should be
$requested=date("d/m/y H:i:s", time());

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.