2008-04-24, 01:09 AM
Hey there.
I'm trying to build my site around MyBB and it's login system, and what I'm working on is an area for users to submit content and have it stored in a database not of MyBB's (specifically now, a user blogging system).
I followed elements of the MyBB integration tutorial to do this.
This is included at the top of the document:
Along the lines of the page, this affected form is included:
Anywho, my database connection is to x_blogs.
I get this error when I submit the form:
If anyone can help me out with this, I'd really appreciate it.
I'm trying to build my site around MyBB and it's login system, and what I'm working on is an area for users to submit content and have it stored in a database not of MyBB's (specifically now, a user blogging system).
I followed elements of the MyBB integration tutorial to do this.
This is included at the top of the document:
<?php
define("IN_MYBB",1);
chdir('../forum'); // path to MyBB
require './global.php';
?>
I need that because the page needs to call for the logged-in user's username an uid. Along the lines of the page, this affected form is included:
<?php
if($mybb->user['uid'])
{
// Display blog posting form
?>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<p><strong>Title :</strong><br />
<input type="input" name="title" size="25" maxlength="70" width="500" value="<?php if(isset($_POST['title'])) echo $_POST['title']; ?>" />
</p>
<!-- Author name and UID START -->
<input type="hidden" name="author_username" maxlength="11" value="<?php echo "".$mybb->user['username'].""; ?>" />
<input type="hidden" name="author_uid" maxlength="50" value="<?php echo "".$mybb->user['uid'].""; ?>" />
<!-- Author name and UID END -->
<p><strong>Your post:</strong><br />
<textarea cols="100" rows="10" name="blog_post"><?php if(isset($_POST['blog_post'])) echo $_POST['blog_post']; ?></textarea></p>
<p><input type="submit" name="submit" value="Submit" /></p>
<input type="hidden" name="submitted" value="TRUE" /></p>
</form>
<?php
}
else
{
// The user is not logged in
echo "You are not logged in. Please log in or register to post a blog post.";
}
?>
If you're wondering why the form action is $_SERVER['PHP_SELF'];, it's because I need the form to return to the same page with errors of the input fields.Anywho, my database connection is to x_blogs.
I get this error when I submit the form:
Quote:MySQL error: 1146Why is it calling for mybb_users? Is it something in the global.php file? How can I change that for the form submission? It's trying to write to the wrong database.
Table 'x_blogs.mybb_users' doesn't exist
Query: UPDATE mybb_users SET lastactive='1208999094', timeonline=timeonline+7 WHERE uid='1' LIMIT 1
If anyone can help me out with this, I'd really appreciate it.