零日期和时间帮助! ! ! ! [英] Zero date and time help! ! ! !

查看:80
本文介绍了零日期和时间帮助! ! ! !的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我问题当我插入日期和时间它会显示为零。



这是我的桌子



post_id | int PK

cat_id | int

类别| varchar

留言|文字

trn_date | dateandtime

postedby | varchar



我尝试过:



Hi I problem when I Insert the date and time it will appear as zero.

Here's my table

post_id | int PK
cat_id | int
categories | varchar
message | Text
trn_date | dateandtime
postedby | varchar

What I have tried:

<?php

$id = $_GET['ID'];


$action = isset($_POST['action']) ? $_POST['action'] : "";

if($action=='create'){ 



include 'dbconnect.php';



$query = "insert into tbltopics

set


categories = '".$con->real_escape_string($_POST['categories'])."',

message = '".$con->real_escape_string($_POST['message'])."',

trn_date = '".$con->real_escape_string($_POST['trn_date'])."',




postedby = '".$con->real_escape_string ($_SESSION['Username'] )."'";



if( $con->query($query) ) {



}else{



echo "<center>Database Error: Unable to create record.</center>";

}


$con->close();

}

?>





<br><br>
<center><form action='#' method='post' border='0' autocomplete='on'>
  
<table>
<tr>

<td>Categories</td>

<td><input rows="6" cols="100" type='text' name='categories' required='required' > </td>

<tr>


<tr>

<td>Question</td>

<td><textarea rows="6" cols="100" type='text' name='message' required='required' /></textarea></td>

<tr>

<td></td>

<td>

<input type='hidden' name='action' value='create' />

<input class='btnE' type='submit' value='Post' />



</td>

</tr>

</table>

</form></center>




</body>

</html>

推荐答案

id =


_GET ['ID'];
_GET['ID'];


action = isset(
action = isset(


这篇关于零日期和时间帮助! ! ! !的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆