hata mysql veri ekleme sırasında oluştu

0 Cevap php

Benim kod -

require 'database.php';
$uid = $_SESSION['UserId'];
$title = $_POST['imgtitle'];
$tag = $_POST['imgtag'];
$date = date("d-m-y");  

$q = "INSERT into album (`o_id`, `title`, `src`, `tag`, `date`)
VALUES('$uid', '$title', '$image_name', '$tag', '$date'";

$result = $mysqli->query($q) or die(mysqli_error($mysqli));

if ($result) 
    {   
        echo "<h1>File Uploaded Successfully! Upload more...!</h1>";
    }

benim database.php -

<?php

$db_name = "szdb";
$db_server = "localhost";
$db_user = "root";
$db_pass = "";

$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());

?>

ERROR- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2

0 Cevap