我想创建一个消息传递系统,这里是它的php代码
SQLite version 3.15.1 2016-11-04 12:08:49
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> create table x(timestamp real);
sqlite> insert into x values (2.75);
sqlite> insert into x values(35065);
sqlite> select * from x;
2.75
35065.0
sqlite> select strftime('%J', '1899-12-30'); -- base time as a Julian Day Number
2415018.5
sqlite> select datetime(timestamp+2415018.5) from x;
1900-01-01 18:00:00
1996-01-01 00:00:00
select cast(strftime('%m', timestamp+2415018.5) as integer), cast(strftime('%d', timestamp+2415018.5) as integer) from x;
1|1
1|1
sqlite>
并且html是<?php
$connect= new mysqli('localhost', 'root','' ,'user');
if($connect->connect_error){
die('connection failed bruh');
} else
echo 'connected';
$message= $_POST('message');
$name= $_POST('name');
$sql = "INSERT message into user WHERE name=$name AND message=$message ";
$result = $connect-> query($sql);
if ($result-> num_rows > 1 ){
while ($result->fetch_assoc()){
echo $row["$message"];
}
} else {
echo 'some error';
}
?>
<?php
$connect= new mysqli('localhost', 'root','' ,'user');
if($connect->connect_error){
die('connection failed bruh');
} else
echo 'connected';
$message= $_POST('message');
$name= $_POST('name');
$sql = "INSERT message into user WHERE name=$name AND message=$message ";
$result = $connect-> query($sql);
if ($result-> num_rows > 1 ){
while ($result->fetch_assoc()){
echo $row["$message"];
}
} else {
echo 'some error';
}
?>
我得到了致命错误:
我遇到此错误,如果有人认为此代码有更多错误,请告诉我 我使用了大括号,但它仍然无法正常工作
答案 0 :(得分:0)
您需要使用方括号来访问$_POST
的数组属性:
$message= $_POST['message'];
$name= $_POST['name'];
答案 1 :(得分:0)
你必须遇到主要错误:
1
html>
<head>
<title>Square Stairs™</title>
</head>
<body bgcolor="#000">
<canvas id="canvas" style="border:3px solid #fff"></canvas>
</body>
</html>
2
$message= $_POST['message'];
$name= $_POST['name'];