LenKaiser Posted October 25, 2014 Share Posted October 25, 2014 (edited) 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 October 25, 2014 by LenKaiser Quote Link to comment https://forums.phpfreaks.com/topic/292045-problem-with-mysqli_result/ Share on other sites More sharing options...
requinix Posted October 25, 2014 Share Posted October 25, 2014 Can you find the code that defines $q? Quote Link to comment https://forums.phpfreaks.com/topic/292045-problem-with-mysqli_result/#findComment-1494649 Share on other sites More sharing options...
LenKaiser Posted October 25, 2014 Author Share Posted October 25, 2014 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; } Quote Link to comment https://forums.phpfreaks.com/topic/292045-problem-with-mysqli_result/#findComment-1494759 Share on other sites More sharing options...
requinix Posted October 25, 2014 Share Posted October 25, 2014 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? Quote Link to comment https://forums.phpfreaks.com/topic/292045-problem-with-mysqli_result/#findComment-1494765 Share on other sites More sharing options...
LenKaiser Posted October 31, 2014 Author Share Posted October 31, 2014 I'm not sure but I'm guessing its the beginning of the questions when they have been output. Is attaching the file a no-no here. I did that at the vbulletin.org forum and thought they were gonna have kittens. Quote Link to comment https://forums.phpfreaks.com/topic/292045-problem-with-mysqli_result/#findComment-1495350 Share on other sites More sharing options...
requinix Posted October 31, 2014 Share Posted October 31, 2014 If you're not sure then the best way to find out would be to output it. $hook will be a string so you don't have to do anything special to it first. Quote Link to comment https://forums.phpfreaks.com/topic/292045-problem-with-mysqli_result/#findComment-1495351 Share on other sites More sharing options...
LenKaiser Posted October 31, 2014 Author Share Posted October 31, 2014 If you're not sure then the best way to find out would be to output it. $hook will be a string so you don't have to do anything special to it first. Uh I have no idea what you just said. How do I out put it when its not working on the site? Quote Link to comment https://forums.phpfreaks.com/topic/292045-problem-with-mysqli_result/#findComment-1495401 Share on other sites More sharing options...
requinix Posted October 31, 2014 Share Posted October 31, 2014 (edited) $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 October 31, 2014 by requinix Quote Link to comment https://forums.phpfreaks.com/topic/292045-problem-with-mysqli_result/#findComment-1495402 Share on other sites More sharing options...
LenKaiser Posted November 1, 2014 Author Share Posted November 1, 2014 Sorry I have no idea what you are talking about. I'm not a PHP coder. I know very little about PHP or coding anything at all in PHP. Quote Link to comment https://forums.phpfreaks.com/topic/292045-problem-with-mysqli_result/#findComment-1495425 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.