Jump to content

Problem With mysqli_result


LenKaiser

Recommended Posts

Hello, I have a serious problem that I need to fix for a client and I have no idea how to fix it. I have a client that is running vBulletin 4.2.2 P1 and since a server upgrade we have gotten this error when they to access a hack that we have installed called Easy Forms. I would not ask here except there is little to no help on vbulletin.org. The coder who created this hack is in the wind and has not been on the site since October 4, has a full PM box and is not answering messages and others on the site are trying to help but I'm not a php coder so i have no idea where to start to fix it even with their help. Here is the error we get:

 

 

Fatal error: Cannot use object of type mysqli_result as array in /home/public_html/forum/forms.php on line 1242

 

The form.php is the file that pertains to the hack we have installed. This hack was isntalled BEFORE the host went and screwed around with stuff and it worked fine before hand.

 

The code around that line and including that line is:

$formbits = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "formbits WHERE fid = $fid ORDER BY displayorder ASC");
	while($formbit = $vbulletin->db->fetch_array($formbits))
	{
($hook = vBulletinHook::fetch_hook('easy_forms_view_question_start')) ? eval($hook) : false;
		if ($formbit[guestonly] && $vbulletin->userinfo[userid])
		{
			continue;
		}
		$formbit['value'] = $q[$formbit[id]];
		$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); 
		$formbit[question] = $bbcode_parser->parse($formbit[question]);
		$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); 
		$formbit[description] = $bbcode_parser->parse($formbit[description]);
		$formbit['qlc'] = trim($formbit['question']);
		$formbit['qlc'] = substr($formbit['qlc'], -1);
		if ($formbit['qlc'] != "?" && $formbit['qlc'] != ":" && $formbit['type'] != 7)
		{
			$formbit['question'] = $formbit['question'] . ":";
		}
		if ($formbit['compulsory'] == 1)
		{
			$formbit['question'] = $formbit['question'] . $vbphrase[form_compulsory_symbol];
		}
		$question++;
		$formbit[inputerror] = $inputerror[$formbit[id]];
		if ($formbit['type'] == 1)
		{

Line 1242 is $formbit['value'] = $q[$formbit[id]];. If you need more code than that please let me know. I think it has to do with the questions being added. I have uninstalled this hack and reinstalled it as a fresh install twice and still get the same errors. When I reinstalled the second time instead of importing the client's backed up form I created a fresh test one and when I clicked on "View Form" before adding any questions to the form it worked just fine. But after I added questions I click on the "View Form" link and get that error again, so it is somehow related to the questions.

 

Some info about what we are running on the site:

 

vBulletin 4.2.2 P1 Suite

PHP 5.4.33

MySQL 5.5.37

 

i have been informed that the code would now need arrays but that is about all they have said which is great help if I were a programmer. I'm able to edit the code (With direction) with no problem, but I do not hand code it or know where everything should or should not be. Any help would be great on this matter. Thanks.

Edited by LenKaiser
Link to comment
Share on other sites

Can you find the code that defines $q?

Hmmmmmm. Is this what you need? If not I can copy and paste the file.

$q = $qa = $qn = $qo = $ddd = array();
	$formbits = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "formbits WHERE fid = $fid ORDER BY displayorder ASC");
	while($formbit = $vbulletin->db->fetch_array($formbits))
	{
		$ddd[$formbit[id]] = $formbit[quiz];
		($hook = vBulletinHook::fetch_hook('easy_forms_post_question_start')) ? eval($hook) : false;
		if ($formbit[guestonly] && $vbulletin->userinfo[userid])
		{
			continue;
		}
Link to comment
Share on other sites

There's still something missing: code (on 1242, even) tries to use values in $q but with what you've posted nothing gets into that array.

 

Here's what I'm thinking. $formbit should definitely be an array, that's what the documentation says. So it must be $q. I'm guessing the--

 

Oh, the eval...?

($hook = vBulletinHook::fetch_hook('easy_forms_view_question_start')) ? eval($hook) : false;
What is the value (output it or whatever) of that $hook?
Link to comment
Share on other sites

$hook, the variable, as shown in that one line of code I posted a few days ago, works just fine. At the moment that's all I care about.

 

Output it immediately. Use echo, or print, or whatever else you'd like. Then the script will fatal, yes, but that's okay because it outputted the value of $hook before that happened.

Edited by requinix
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.