我正在尝试在我正在处理的网站上使用这个简单的查询,但它没有将任何数据插入数据库!
<?php
// Include database configuration
include('../config.php');
// Include ezSQL core
include_once "ezSQL/ez_sql_core.php";
// Include ezSQL database mysql component
include_once "ezSQL/ez_sql_mysql.php";
// Initialise database object and establish a connection
$db = new ezSQL_mysql($db_user,$db_pass,$db_database,$db_host);
$the_file = "video.mp4";
$the_image = "image.jpg";
$the_title = "Title";
$the_description = "lokr dry ceyrc cetcn cebtyn cetbny rnyfb rybrnr rybynum nyr";
$the_anime = "Anime";
$the_genre = "Genre";
$the_slug = "anime";
$db->query("INSERT INTO video (file, image, title, description, anime, genre, slug) VALUES ($the_file, $the_image, $the_title, $the_description, $the_anime, $the_genre, $the_slug)");
$db->debug();
?>
请帮我一点!
答案 0 :(得分:0)
所有非数字列都需要引用
$ db-&gt; query(“INSERT INTO video(文件,图片,标题,描述,动漫,流派,slu))VALUES('$ the_file','$ the_image','$ the_title','$ the_description' ,'$ the_anime','$ the_genre','$ the_slug')“);
答案 1 :(得分:0)
因为要插入的值是字符串,所以你应该尝试这样的事情:
$db->query("INSERT INTO video (file, image, title, description, anime, genre, slug) VALUES ('$the_file', '$the_image', '$the_title', '$the_description', '$the_anime', '$the_genre', '$the_slug')");