使用PHP,MYSQL制作评论框时出错。多次尝试但无法纠正 [英] Some error in making a comment box using PHP, MYSQL. Tried many times but couldnot correct

查看:61
本文介绍了使用PHP,MYSQL制作评论框时出错。多次尝试但无法纠正的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP,MYSQL中做了一个评论框。编写了代码。问题是评论没有显示但是它存储在数据库中。数据库的名称是状态,表的名称也是状态。该表只有一个字段,其名称也是状态



index.php



< html>

< body>

I'm making a comment box in PHP, MYSQL. Have written the code. The problem is that comments are not getting displayed but its getting stored in the database. The name of the database is status, the name of the table is also status.The table has only one field, whose name is also status.

index.php

<html>
<body>

<form method = "post" action = "process.php">
<textarea name = "data" rows = "3" cols = "80" > </textarea> &nbsp; &nbsp;

<input type = "submit" name = "post" value = "POST">
</form>







<?php

$dbc = mysqli_connect('localhost', 'dhruv', 'password', 'status') or die('Error connecting to databse') ;

$query = "SELECT * FROM status" ;

 $result = mysqli_query($dbc, $query) or die('error querying') ;

 while ($row = mysqli_fetch_array($result))
 {
  echo $_row['status'];
 }

mysqli_close($dbc) ;

?>





< / body>

< / html>





process.php





</body>
</html>


process.php

<?php

$dbc = mysqli_connect('localhost', 'dhruv', 'password', 'status') or die('Error connecting to databse') ;

$status = $_POST['data'] ;

$query = "INSERT INTO status (status)" . "VALUES('status')" ;

mysqli_query($dbc,$query) or die('error querying') ;

mysqli_close($dbc) ;

header( 'Location: index.php' ) ;

?>







我尝试了很多次但是却找不到这里的错误。任何帮助都会很棒。




I tried many times but couldnot find what is wrong here. Any help will be great.

推荐答案

dbc = mysqli_connect(' localhost'' dhruv'' password'' status' die(' 连接到数据库'时出错;);

dbc = mysqli_connect('localhost', 'dhruv', 'password', 'status') or die('Error connecting to databse') ;


query = SELECT * FROM status;

query = "SELECT * FROM status" ;


result = mysqli_query(
result = mysqli_query(


这篇关于使用PHP,MYSQL制作评论框时出错。多次尝试但无法纠正的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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