Php 将个人消息代码从MYSQL转换为MYSQLi

Php 将个人消息代码从MYSQL转换为MYSQLi,php,mysql,mysqli,messaging,Php,Mysql,Mysqli,Messaging,我正在尝试在我的项目中构建一个个人消息传递系统。到目前为止,我一直在项目中使用MYSQLi,我刚刚找到了用于PMS的代码。现在我不知道如何将这个mysql代码转换成mysqli <?php session_start(); $message = $_POST['forward2']; if (isset($_POST['submit'])) { // if the form has been submitted, this inserts it into the Databas

我正在尝试在我的项目中构建一个个人消息传递系统。到目前为止,我一直在项目中使用MYSQLi,我刚刚找到了用于PMS的代码。现在我不知道如何将这个mysql代码转换成mysqli

<?php    
session_start();

$message = $_POST['forward2'];
 if (isset($_POST['submit']))
{
// if the form has been submitted, this inserts it into the Database 
  $to_user = $_POST['to_user'];
  $from_user = $_POST['from_user'];
  $message = $_POST['message'];
  mysql_query("INSERT INTO messages (to_user, message, from_user) VALUES ('$to_user', '$message', '$from_user')")or die(mysql_error());
  echo "PM succesfully sent!"; 
}
else
{
    // if the form has not been submitted, this will show the form
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<table border="0">
<tr><td colspan=2><h3>Send PM:</h3></td></tr>
<tr><td></td><td>
<input type="hidden" name="from_user" maxlength="32" value = <?php echo $_SESSION['username']; ?>>
</td></tr>
<tr><td>To User: </td><td>
<input type="text" name="to_user" maxlength="32" value = "">
</td></tr>
<tr><td>Message: </td><td>
<TEXTAREA NAME="message" COLS=50 ROWS=10 WRAP=SOFT></TEXTAREA>
</td></tr>
<tr><td colspan="2" align="right">
<input type="submit" name="submit" value="Send Message">
</td></tr>
</table>
</form>
<?php
}
?>
>
致用户:
信息:
  • 为自己准备一个关于mysqli的教程
  • 坚持到底
  • 创建一些简单的基于mysqli的应用程序
  • 让自己熟悉mysqli
  • 然后从过渡开始

  • 你不是简单地尝试了
    mysqli\u查询
    (mysqli\u)吗?