You have an error in your SQL syntax; check the manual that corresponds to your MySQL
Hi I have the following 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 '-darrenweb.gallery (image,thumbnail,home_img,home_allow,datestamp,description,ti' at line 1
when I am uploading an image with title etc to my databse, it worked fine on an older server (I have moved website to anoter server, I have tried putting the database name in, but still no use :(, any ideas? what I could try?
the database is connected
<?php
// Database Settings
$CFG->db_host = "localhost";
$CFG->db_name = "*******";
$CFG->db_user = "********";
$CFG->db_pass = "*******";
// create database connection
$attempts = 3;
$attempt = 0;
$connection = "";
while ($connection=='' && $attempt<$attempts)
{
$connection = mysql_connect($CFG->db_host, $CFG->db_user, $CFG->db_pass);
mysql_select_db($CFG->db_name, $connection );
if ($connection=='')
$attempt++;
if ($attempt==$attempts)
{
include "holding.php";
exit;
}
}
?>
this is my code
$query = "INSERT INTO ".$CFG->db_name.".gallery (image,thumbnail,home_img,home_allow,datestamp,description,title,galleryid) values ('".$file."','".$db_thumbnail_file."','".$homeimg."','1','".date("U")."','".$_POST["wmessage"]."','".$_POST["wtitle"]."','".$_POST["gid"]."')";
$q = mysql_query($query);
if (!$q) echo mysql_error();
}
thanks