BillyBoB Posted March 14, 2009 Share Posted March 14, 2009 I have a feeling that this error is related to the php. I have an ajax blog system that I am building completely on one page(without reloading). I am currently on the edit system. When you try to edit firebug shows the variables being passed but it never gets set into the database. Heres the code: <?php require_once("objects.php"); $dBase = new Database("Blog"); $dBase->connectDB("user","pass"); $fSql = mysql_query("SELECT * FROM `Entries` WHERE `id` = '$_POST[EntryID]'") or die(mysql_error()); $fData = mysql_fetch_array($fSql); $uSql = mysql_query("SELECT * FROM `Users` WHERE `id` = '$fData[userid]'") or die(mysql_error()); $uData = mysql_fetch_array($uSql); if($uData['SecurityCode']!=$_POST['SecurityCode']) { echo("false"); }else{ $lSql = mysql_query("UPDATE `Entries` SET `title` = '$_POST[title]', `message` = '$_POST[text]' WHERE `id` = '$fSQL[id]'") or die(mysql_error()); echo("true"); } ?> The site is currently at http://dreamshowstudios.net/development/Blog/index.php login is: Admin - 1234. Any help is greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/149368-solved-database-not-updating/ Share on other sites More sharing options...
ridiculous Posted March 14, 2009 Share Posted March 14, 2009 What does your database class look like? Can you post it, please? Do you know if you are getting connected to the database? Quote Link to comment https://forums.phpfreaks.com/topic/149368-solved-database-not-updating/#findComment-784473 Share on other sites More sharing options...
BillyBoB Posted March 14, 2009 Author Share Posted March 14, 2009 Shouldn't be in the db class. I think it shuts the site down if its not working. <?php class Database { var $database = ''; var $debug = ''; var $db = ''; var $connected = 0; function Database($database) { $this->database = $database; } function connectDB($username, $password) { if($this->connected==0) { $this->db .= mysql_connect("localhost",$username,$password) or die("Unable to connect to the database server. The username or password may be incorrect. Please reload this page. If you are viewing this page multiple times please contact the Admin."); $this->db .= mysql_select_db($this->database) or die("Unable to locate the database. The database name may be incorrect. Please reload this page. If you are viewing this page multiple times please contact the Admin."); $this->connected = 1; unset($this->db); } } } ?> The weirdest thing is that it returns the value of true.... like it sent to the database but it totally didn't... Quote Link to comment https://forums.phpfreaks.com/topic/149368-solved-database-not-updating/#findComment-784484 Share on other sites More sharing options...
BillyBoB Posted March 14, 2009 Author Share Posted March 14, 2009 Sorry for taking your time up.. if you look at the third query the "SQL" is caps but on the other variables its lower.... That is way I know I've stayed up too long... But that didn't work either... because its the wrong variable completely... wow. Quote Link to comment https://forums.phpfreaks.com/topic/149368-solved-database-not-updating/#findComment-784489 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.