jamesxg1 Posted August 16, 2009 Share Posted August 16, 2009 Hiya peeps, I have this code, <?php session_start(); class UserInputs { private $compsub; private $compmes; private $dbusername; private $dbpassword; private $dbhost; private $dbbase; function __construct() { $this->randid = mt_rand(); } function MYSQLConnection($dbusername = "root", $dbpassword = "", $dbhost = "localhost", $dbbase = "sli") { $this->dbusername = $dbusername; $this->dbpassword = $dbpassword; $this->dbhost = $dbhost; $this->dbbase = $dbbase; $this->MYSQLConnect = mysql_connect($this->dbhost, $this->dbusername, $this->dbpassword); $this->SelectDB = mysql_select_db($this->dbbase, $this->MYSQLConnect) or die(mysql_error()); return($this->SelectDB); } function Complain($compsub, $compmes) { $this->complainsubject = mysql_real_escape_string(addslashes($compsub)); $this->complainmessage = mysql_real_escape_string(addslashes($compmes)); $this->sesusername = mysql_real_escape_string(addslashes($_SESSION['username'])); $this->sesid = mysql_real_escape_string(addslashes($_SESSION['id'])); $this->randid = mysql_real_escape_string(addslashes(mt_rand())); $this->date = mysql_real_escape_string(addslashes(date("Y-m-d"))); mysql_query("INSERT INTO `complaints` (`mid`, `id`, `username`, `date`, `subject`, `complaint`) VALUES('$this->sesid', '$this->randid', $this->sesusername', '$this->date', '$this->complainsubject', '$this->complainmessage')") or die(mysql_error()); $compdone = "Complaint Added."; return $compdone; } } ?> And im getting this 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 '', '2009-09-16', '', '')' at line 1 does anyone know why ?, Many thanks, James. Link to comment https://forums.phpfreaks.com/topic/170564-solved-date-help/ Share on other sites More sharing options...
deadlyp99 Posted August 16, 2009 Share Posted August 16, 2009 $this->sesusername' At first glance, you simply missed a quote. So try that and let us know Link to comment https://forums.phpfreaks.com/topic/170564-solved-date-help/#findComment-899681 Share on other sites More sharing options...
jamesxg1 Posted August 16, 2009 Author Share Posted August 16, 2009 LMFAO!, It worked lol i feel like a dumb ass now lol, Cheers dude. Many thanks, James. Link to comment https://forums.phpfreaks.com/topic/170564-solved-date-help/#findComment-899684 Share on other sites More sharing options...
deadlyp99 Posted August 16, 2009 Share Posted August 16, 2009 Eh, I do it all the time mate :-] It get's really hard to debug when your server has error reporting turned off Link to comment https://forums.phpfreaks.com/topic/170564-solved-date-help/#findComment-899691 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.