我有关于将数据插入数据库的问题。 [英] I have a problem about insert data to database.

查看:81
本文介绍了我有关于将数据插入数据库的问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用php制作留言板。

但是我不能将数据插入数据库。

我不知道我的代码中有什么问题???

可以有人帮我吗?



I want to make a messageboard with php.
but I cant''t insert data to database.
I dont know what''s wrong in my code???
Can someone help me please?

<!DOCTYPE  HTML>
<html>
<head>
<title> 留言板 </title>
</head>


<body>
<form action="insert.php" method="get">
請輸入名稱: <input type="text" name="name" />
請輸入標題: <input type="text" name="title" />
請輸入留言: <input type="text" name="message"   />
請輸入電子郵件: <input type="text" name="email" />
<input    type="submit"  value="送出留言" name="post"  />
</form>

</body>
</html>




<?php
//This is insert.php

require_once("connectdb.php");// It is success!!


if(isset($_GET["name"])!=""){
    $query_insert = "INSERT INTO '1100108128'.'MB'
    ('USER','TITLE','MESSAGE','TIME','EMAIL')
VALUES (";$query_insert .= "'".$_GET["name"]."',";
    $query_insert .= "'".$_GET["title"]."',";
    $query_insert .= "'".$_GET["message"]."',";
    $query_insert .= "NOW(),";
    $query_insert .= "'".$_GET["email"]."')";
mysql_query($query_insert);
header("Location:Messageboard.php");
}
 ?>

推荐答案

_GET [ name])!= ){
_GET["name"])!=""){


query_insert = INSERT INTO'1100108128'.'MB'
('USER','TITLE','MESSAGE' ,'TIME','EMAIL')
VALUES(
;
query_insert = "INSERT INTO '1100108128'.'MB' ('USER','TITLE','MESSAGE','TIME','EMAIL') VALUES (";


query_insert 。= < span class =code-string> '
query_insert .= "'".


这篇关于我有关于将数据插入数据库的问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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