⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 insert_book.php

📁 php源码 php源码参考
💻 PHP
字号:
<html><head>  <title>Book-O-Rama Book Entry Results</title></head><body><h1>Book-O-Rama Book Entry Results</h1><?php  // create short variable names  $isbn=$_POST['isbn'];  $author=$_POST['author'];  $title=$_POST['title'];  $price=$_POST['price'];  if (!$isbn || !$author || !$title || !$price)  {     echo 'You have not entered all the required details.<br />'          .'Please go back and try again.';     exit;  }  if (!get_magic_quotes_gpc())  {    $isbn = addslashes($isbn);    $author = addslashes($author);    $title = addslashes($title);    $price = doubleval($price);  }  @ $db = new mysqli('localhost', 'bookorama', 'bookorama123', 'books');  if (mysqli_connect_errno())   {     echo 'Error: Could not connect to database.  Please try again later.';     exit;  }  $query = "insert into books values             ('".$isbn."', '".$author."', '".$title."', '".$price."')";   $result = $db->query($query);  if ($result)      echo  $db->affected_rows.' book inserted into database.';   $db->close();?></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -