首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >这个ezSQL查询有什么问题?

这个ezSQL查询有什么问题?
EN

Stack Overflow用户
提问于 2013-06-01 18:08:04
回答 2查看 1.3K关注 0票数 0

我试图在我正在工作的网站上使用这个简单的查询,但它没有向数据库中插入任何数据!

代码语言:javascript
复制
<?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();

?>

请帮我一点忙!

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-06-01 18:22:41

由于您想要插入的值是字符串,因此您应该尝试如下所示:

代码语言:javascript
复制
$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')");
票数 1
EN

Stack Overflow用户

发布于 2013-06-01 18:20:54

所有非数字列都需要引号

代码语言:javascript
复制
$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')");
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16871526

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档