Jump to content

[SOLVED] Database not updating


BillyBoB

Recommended Posts

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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.