collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 685
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Author Topic: Latest Quiz Block (Code) doesnt work on SP 2.3  (Read 8829 times)

0 Members and 1 Guest are viewing this topic.

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Latest Quiz Block (Code) doesnt work on SP 2.3
« on: September 03, 2009, 09:43:29 AM »
Hello,

I have upgraded to SP 2.3 today. But the following code which is for latest quizes is not working on sp 2.3

Code: [Select]
global $smcFunc, $settings, $scripturl;

$result = $smcFunc['db_query']('', '
      SELECT       Q.id_quiz,
               Q.title,
               Q.image,
               Q.updated
      FROM       smf_quiz Q
      WHERE      Q.enabled = 1
      ORDER BY   Q.updated DESC
      LIMIT      0, 8'
   );
echo '<table border="0">';
while ($row = $smcFunc['db_fetch_assoc']($result)) {
   echo '<tr><td><img width="15" height="15" src="' , !empty($row['image']) ? $settings["default_images_url"] . '/quiz_images/Quizes/' . $row['image'] : $settings["default_images_url"] . '/quiz_images/Quizes/Default-64.png' , '"/></td><td><a href="' , $scripturl , '?action=SMFQuiz;sa=categories;id_quiz=' , $row['id_quiz'] , '">' , $smcFunc['db_unescape_string']($row['title']) , '</a></td></tr>';
}
echo '</table>';
   
$smcFunc['db_free_result']($result);

I see the following error..

Quote
Database error in block code. Please check the code

It used to work fine on SP 2.2

Can any one help what has to be done now.

Thanks in adv!

Offline simply sibyl

  • Semi Newbie
  • *
  • Posts: 13
  • Gender: Female
    • The Tent Dwellers
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #1 on: September 03, 2009, 11:23:56 AM »
This one works fine for me with 2.3

Code: [Select]
global $smcFunc, $settings, $scripturl;

$result = $smcFunc['db_query']('', '
SELECT Q.id_quiz,
Q.title,
Q.image,
Q.updated
FROM smf_quiz Q
WHERE Q.enabled = 1
ORDER BY Q.updated DESC
LIMIT 0, 8'
);
echo '<table border="0">';
while ($row = $smcFunc['db_fetch_assoc']($result)) {
   echo '<tr><td><img width="15" height="15" src="' , !empty($row['image']) ? $settings["default_images_url"] . '/quiz_images/Quizes/' . $row['image'] : $settings["default_images_url"] . '/quiz_images/Quizes/Default-64.png' , '"/></td><td><a href="' , $scripturl , '?action=SMFQuiz;sa=categories;id_quiz=' , $row['id_quiz'] , '">' , $smcFunc['db_unescape_string']($row['title']) , '</a></td></tr>';
}
echo '</table>';

$smcFunc['db_free_result']($result);

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #2 on: September 05, 2009, 12:45:10 AM »
Hey thanks for the code..

I have checked your code, I can see the preview of the block but when i click on 'add block' i see the error

Quote
Database error in block code. Please check the code

please..any help?

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #3 on: September 06, 2009, 02:46:53 AM »
I hate to BUMP.. I need support though..

This block is important on my site because it gives an idea to the members about the latest quizes and encourages to take them.

Thanks!

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #4 on: September 06, 2009, 11:54:25 AM »
Hello Guys,

The problem persists with another code too... :ill:

Code: [Select]
global $smcFunc, $settings, $scripturl;

$result = $smcFunc['db_query']('', '
SELECT I.entry_date,
                                        I.entry
FROM smf_quiz_infoboard I
ORDER BY I.entry_date DESC
LIMIT 0, 5'
);
echo '<table border="0">';
while ($row = $smcFunc['db_fetch_assoc']($result)) {
   echo '<tr><td>' , date("M d Y H:i", $row['entry_date']) , '</td><td>' , $row['entry'] , '</td></tr>';
}
echo '</table>';

$smcFunc['db_free_result']($result);

The error is database error in block code. SP 2.3 is having these issues. What would be the reason.

Please help!!

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #5 on: September 13, 2009, 01:01:41 PM »
Guys, Let me know if I should consider that this topic will not be supported here.

Then, I may consider seeking support some where else or downgrading for SP 2.3

Thanks!

Offline simply sibyl

  • Semi Newbie
  • *
  • Posts: 13
  • Gender: Female
    • The Tent Dwellers
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #6 on: September 13, 2009, 04:34:12 PM »
Hey thanks for the code..

I have checked your code, I can see the preview of the block but when i click on 'add block' i see the error

Quote
Database error in block code. Please check the code

please..any help?

humm   no idea why it wont work for you...  same code works just fine on a friends forum here:

http://www.ourhangout.org/forum/

Also works on my own forum -  did nothing more too it - same exact code I gave you.

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #7 on: September 14, 2009, 08:42:19 AM »
That is exactly what I am not able to understand. This is happening only after the upgrade..

I have no clue what is the database error..!

Help- Some one? Any one?

Offline Old Fossil

  • Beta Tester
  • *
  • Posts: 796
  • Gender: Male
  • SMF Version: 2.0.4
  • SP Version: 2.3.5
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #8 on: September 16, 2009, 02:01:06 AM »
That is exactly what I am not able to understand. This is happening only after the upgrade..

I have no clue what is the database error..!

Help- Some one? Any one?

Hi

Sorry I have just seen this topic.

Please let me know which mod you use for the quiz then I can add to my test forum to see if it happens to me too.
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #9 on: September 16, 2009, 02:06:40 AM »
Thanks listener. Its the SMF Quiz mod.

Unfortunately, the author of the mod only supports porta mx portal and he recommends that for that mod.

Offline Old Fossil

  • Beta Tester
  • *
  • Posts: 796
  • Gender: Male
  • SMF Version: 2.0.4
  • SP Version: 2.3.5
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #10 on: September 16, 2009, 02:08:37 AM »
can I ask if you had any errors when installing the quiz?

Also please confirm your smf version.
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #11 on: September 16, 2009, 02:10:31 AM »
I did not have any errors while installation. The problem is with SP 2.3 block not with the quiz mod. The custom php blocks with the above codes were working fine SP 2.2, after the upgrade, its showing the db error which I posted above.

I am using smf 2.0 rc 1.2 and sp 2.3. Thanks!

Offline Old Fossil

  • Beta Tester
  • *
  • Posts: 796
  • Gender: Male
  • SMF Version: 2.0.4
  • SP Version: 2.3.5
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #12 on: September 16, 2009, 02:12:42 AM »
It may be worth you making a report in the bug tracker.

Hope you don't get squeamish with insects.
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #13 on: September 16, 2009, 02:17:27 AM »
It may be worth you making a report in the bug tracker.

Hope you don't get squeamish with insects.

Lets have a go at trying to work out what the problem actually is, before posting a bugreport. ;)

I suspect that there is an issue relating to the PHP validator within SimplePortal (especially as we have already had some other issues).

For now you can use this solution:
Turn on the 'Disable PHP Validation' setting, in your admin panel under SimplePortal -> Configuration -> General Settings.
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #14 on: September 16, 2009, 02:27:21 AM »
Ok Nathaniel,

I have done it and the custom blocks are live. Thanks much listener and nathaniel!

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #15 on: September 16, 2009, 02:30:00 AM »
The issue is because of the WHERE clause. It is not properly formatted.

I am assuming it is the PHP validation check that SP is doing is somehow removing the set in the SQL "WHERE" statement. While turning this off will perhaps solve it, I would suggest at least making it clean.

The format should be: FROM column AS extension

In the example you have shown, you have the following syntax:

Code: [Select]
      FROM       smf_quiz Q
This is incorrect as you did not set the extension of which all the previous fields were grabbed. Technically they're not required as you're only grabbing information from one specific source and you are not joining in any other resources, so you could set completely get rid of the "Q." extensions and remove the stray "Q" from the "FROM" statement

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #16 on: September 16, 2009, 02:40:31 AM »
Very sorry ccbtimewiz,

I dont know PHP- Did you mean to say that I should delete this code?

Code: [Select]
   FROM       smf_quiz Q

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #17 on: September 16, 2009, 11:22:55 AM »
Take this:

Code: [Select]
global $smcFunc, $settings, $scripturl;

$result = $smcFunc['db_query']('', '
      SELECT       Q.id_quiz,
               Q.title,
               Q.image,
               Q.updated
      FROM       smf_quiz Q
      WHERE      Q.enabled = 1
      ORDER BY   Q.updated DESC
      LIMIT      0, 8'
   );
echo '<table border="0">';
while ($row = $smcFunc['db_fetch_assoc']($result)) {
   echo '<tr><td><img width="15" height="15" src="' , !empty($row['image']) ? $settings["default_images_url"] . '/quiz_images/Quizes/' . $row['image'] : $settings["default_images_url"] . '/quiz_images/Quizes/Default-64.png' , '"/></td><td><a href="' , $scripturl , '?action=SMFQuiz;sa=categories;id_quiz=' , $row['id_quiz'] , '">' , $smcFunc['db_unescape_string']($row['title']) , '</a></td></tr>';
}
echo '</table>';
   
$smcFunc['db_free_result']($result);

Replace with:
Code: [Select]
global $smcFunc, $settings, $scripturl;

$result = $smcFunc['db_query']('', '
SELECT id_quiz, title, image, updated
FROM smf_quiz
WHERE enabled = {int:enabled}
ORDER BY updated DESC
LIMIT 0, 8',
array(
'enabled' => 1,
)
);

$quizzes = array();
while ($row = $smcFunc['db_fetch_assoc']($result))
{
$quizzes[] = array(
'image' => $row['image'],
'title' => stripslashes($row['title']),
);
}
$smcFunc['db_free_result']($result);

echo '
<table border="0">';

foreach ($quizzes as $content)
{
echo '
<tr>
<td>
<img width="15" height="15" src="' , !empty($content['image']) ? $settings['default_images_url'] . '/quiz_images/Quizes/' . $content['image'] : $settings['default_images_url'] . '/quiz_images/Quizes/Default-64.png' , '"/>
</td>
<td>
<a href="' , $scripturl , '?action=SMFQuiz;sa=categories;id_quiz=', $row['id_quiz'] , '">' , $content['title'], '</a>
</td>
</tr>';
}

echo '
</table>';

Offline navjotjsingh

  • Newbie
  • Posts: 3
  • Gender: Male
    • Genelia Online Forums
  • SMF Version: 2 RC2
  • SP Version: 2.3.2
Re: Latest Quiz Block (Code) doesnt work on SP 2.3
« Reply #18 on: April 06, 2010, 07:58:46 AM »
What code should I use for SMF 2.0RC2 and SimplePortal 2.3.2? None of the code listed above works.