Creating a page with a fillable sheet [SOLVED]
#12
(2019-01-03, 09:50 PM)OmarĀ G. Wrote: Trying to guess your DB table structure, probably something of the sorts of the following should work:
$mybb->user['uid'] = (int)$mybb->user['uid'];//(probably not necessary) (current user)
$query = $db->simple_select('YOUR_TABLE_NAME', '*', "uid='{$mybb->user['uid']}'");

if($db->num_rows($query))
{
	error("There is a row for you already in the database, regardless of its content you can't create a new one.");
}

I would assume you are using $db->insert_query() to insert your data into the DB, and you can use $db->update_query() if you want to update data as well.

You can check the documentation regarding DB methods in the following link:
https://docs.mybb.com/1.8/development/pl...e-methods/

That's it! I just did it. It works perfectly, thank you so much for your help!
Reply


Messages In This Thread
RE: Creating a page with a fillable sheet - by enrolmudas - 2019-01-03, 10:27 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)