Home > Article > Backend Development > Use PHP to connect to the database to implement the message board function
The editor below will bring you an example of using PHP to connect to the database to implement the message board function (recommended). The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look.
PHP implements the message board function:
1 The first is the login page:
留言板登录
2 After the login page is completed, you need to enter the login processing page, which is the messloginchuli.php submitted above
query($sql,0); //var_dump($arr[0][0]); if($arr[0][0]=$pwd && !empty($pwd)){ $_SESSION["uid"]=$uid; header("location:message.php"); } ?>
The login page looks like this:
3. After the login is completed, you will enter the home page. The following is the table of the designed database and the code of the main page:
##
发送人 | 发送时间 | 接收人 | 信息内容 |
---|---|---|---|
{$v[1]} | {$v[2]} | {$v[3]} | {$v[4]} |
The code is written here, and the more important part is completed. Below It is time to enter the release information page, which is equivalent to the added page written before. The processing page is no different from before. The difference is that the current processing page is operated when the user is logged in, and all logins need to be logged in using session. The pages under the circumstances are connected
The effect of the main page is as shown in the figure:
4. The last is the information release page, where you can send information to anyone
The code is as follows:##
发布信息界面
5. After publishing the information, you have to enter the processing page, which is the submitted infochuli.php, and finally return to send Information interface
query($sql); if($arr && !empty($arr)){ header("location:publish_info.php"); }else{ echo "发送失败!"; } ?>
The above is the detailed content of Use PHP to connect to the database to implement the message board function. For more information, please follow other related articles on the PHP Chinese website!