Latest topics code is fetching replies too

Discussion forum for MOD Writers regarding MOD Development.
AwesomeStyle
Registered User
Posts: 64
Joined: Tue Jul 16, 2013 7:10 pm

Re: Latest topics code is fetching replies too

Post by AwesomeStyle » Mon Dec 02, 2013 7:19 pm

Thanks for the code, it works perfectly.
It seems that the problem was in the posts_row; when I changed it to topics_row it worked.
Also, you don't need to specify all tables in the SELECT statement. I used * (all tables).
I will install MODs for your forum as cheap as 5-15$ in BitCoin depending on the MOD install level & time. Contact via PM.

User avatar
ViolaF
Registered User
Posts: 1458
Joined: Tue Aug 14, 2012 11:52 pm

Re: Latest topics code is fetching replies too

Post by ViolaF » Mon Dec 02, 2013 7:26 pm

AwesomeStyle wrote:I used * (all tables).
so more server load ;)

AwesomeStyle
Registered User
Posts: 64
Joined: Tue Jul 16, 2013 7:10 pm

Re: Latest topics code is fetching replies too

Post by AwesomeStyle » Mon Dec 02, 2013 7:37 pm

ViolaF wrote:
AwesomeStyle wrote:I used * (all tables).
so more server load ;)
Oh, thanks for the notice :)
I will install MODs for your forum as cheap as 5-15$ in BitCoin depending on the MOD install level & time. Contact via PM.

User avatar
ViolaF
Registered User
Posts: 1458
Joined: Tue Aug 14, 2012 11:52 pm

Re: Latest topics code is fetching replies too

Post by ViolaF » Mon Dec 02, 2013 7:48 pm

no prob'. here you can see, which columns are unneeded loaded, if * is in use :geek:
https://wiki.phpbb.com/Table.phpbb_topics

AwesomeStyle
Registered User
Posts: 64
Joined: Tue Jul 16, 2013 7:10 pm

Re: Latest topics code is fetching replies too

Post by AwesomeStyle » Mon Dec 02, 2013 11:21 pm

When I want to put the code in a class, I get this error:

Code: Select all

Fatal error: Cannot redeclare deregister_globals() (previously declared in C:\xampp\htdocs\includes\startup.php:47) in C:\xampp\htdocs\includes\startup.php on line 114
Current code:
http://pastebin.com/raw.php?i=4V5s00ZP
I will install MODs for your forum as cheap as 5-15$ in BitCoin depending on the MOD install level & time. Contact via PM.

User avatar
ViolaF
Registered User
Posts: 1458
Joined: Tue Aug 14, 2012 11:52 pm

Re: Latest topics code is fetching replies too

Post by ViolaF » Mon Dec 02, 2013 11:31 pm

just remove the doubled function (not the global, but the xtra)

User avatar
ViolaF
Registered User
Posts: 1458
Joined: Tue Aug 14, 2012 11:52 pm

Re: Latest topics code is fetching replies too

Post by ViolaF » Mon Dec 02, 2013 11:48 pm

what is startup.php and why you use [size=130]*[/size] again to fetch topic columns data from table?
ok, your choice. also you can use http://php.net/manual/en/function.function-exists.php

Code: Select all

if (!function_exists('deregister_globals')) {
$your_doubled_deregister_globals_whatever_function;
} 
i think you should over-thought some intentions of the code and clean it a bit.

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25485
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Latest topics code is fetching replies too

Post by Paul » Tue Dec 03, 2013 7:29 am

AwesomeStyle wrote:When I want to put the code in a class, I get this error:

Code: Select all

Fatal error: Cannot redeclare deregister_globals() (previously declared in C:\xampp\htdocs\includes\startup.php:47) in C:\xampp\htdocs\includes\startup.php on line 114
Current code:
http://pastebin.com/raw.php?i=4V5s00ZP
You include common.php twice.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

AwesomeStyle
Registered User
Posts: 64
Joined: Tue Jul 16, 2013 7:10 pm

Re: Latest topics code is fetching replies too

Post by AwesomeStyle » Tue Dec 03, 2013 3:17 pm

When I comment out the code in the main() function in my class that is including common.php twice, I get this error:
Call to a member function sql_in_set() on a non-object

It is important to me that I have the portal class in another PHP file so I can include the code in any external phpBB script and call/use the class I want.
I will install MODs for your forum as cheap as 5-15$ in BitCoin depending on the MOD install level & time. Contact via PM.

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25485
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Latest topics code is fetching replies too

Post by Paul » Tue Dec 03, 2013 5:06 pm

you need to add global $db; if you want to use the global $db variable.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

AwesomeStyle
Registered User
Posts: 64
Joined: Tue Jul 16, 2013 7:10 pm

Re: Latest topics code is fetching replies too

Post by AwesomeStyle » Tue Dec 03, 2013 5:38 pm

Thanks for the answer, I got working everything that I wanted thanks to a great support :)
I will install MODs for your forum as cheap as 5-15$ in BitCoin depending on the MOD install level & time. Contact via PM.

Locked

Return to “[3.0.x] MOD Writers Discussion”