I'm breaking the plugins page with my plugin
#1
So I've coded this really shameful plugin which I wanted to use to intercept and handle a form submission for index.php.

The only code inside it is the necessary _info() function and above that, I've added a hook to index_start.

function nsfw_checksfw()
{
	global $db, $mybb;
	$uUID = $mybb->user['uid'];
	$newFid = $mybb->input['newfid'];
	
	if (isset($newFid) && isset($uUID)) {
		$db->write_query("INSERT INTO ".TABLE_PREFIX."userfields (fid9) VALUES ('".$newFid."') WHERE ufid = ('".$uUID."')";
	}
}


The above is the function that breaks the plugins page, and also renders me totally bumped. I've tried a lot of things and I'm not able to get it working.

The actual line in the above code that 'breaks' the plugin is the write query statement that I make.
removing this line makes it all work, but also disables what I need.

$db->write_query("INSERT INTO ".TABLE_PREFIX."userfields (fid9) VALUES ('".$newFid."') WHERE ufid = ('".$uUID."')";


So it's my first time doing a simple plugin and maybe I'm just a complete dounce, I've succesfully edited and manipulated plugins before but this time I'm stomped.

I was missing a parenthesis sorry guys lol.


So now I've realised my query is wrong, but I can't seem to find out how?

- EDIT:

Got it all working, thanks for your help, luckily for me I just needed to use the corret UPDATE statement .. Mhm
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)