문제

I am trying to use this simple query on a website I am working on but it is not inserting any data into the database!

<?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();

?>

Please help me a bit here!

도움이 되었습니까?

해결책

since the values that you want to insert are strings you should try something like this:

$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')");

다른 팁

all non-numeric column requires quote

$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')");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top