Log in

View Full Version : In need of ways to reduce queries! And also a small question!


Velocd
07-02-2002, 08:37 PM
I'm currently going through most of my PHP files insuring that templates used are in the $templatesused part of the code in the top, such as my forum/index.php. Especially with index.php, but even when I do this my forum home page still has a massive amount of queries (it reduced by 2). I don't have too many hacks installed on the forum home, just some statistical ones. But, well..(here comes the ugly part), I have 40 queries on my forum home. What could be some other causes of how these queries are being generated other than the obvious $Db_site->query(" function? And maybe some solutions to go along :)

I have a small question also. In the newthread.php, and similar posting files also, at the very top are two $templatesused lines, but one of them is full of vbcode templates, and has a dot just before the = sign.

ie:

newthread.php:

$templatesused = "newpost_postpreview
$templatesused.="vbcode_smilies


What is the purpose of the dot, and why not just include the vbcode's in the above templateused list? Could it be a method of organization?

Sorry for all the questions, just trying to learn as much as I can to prevent future problems for myself.

Birdie501
07-02-2002, 09:29 PM
hi,

i am not sure, but if you use this dot you can add something to a variable.
$test="my name is";
$test.="Birdie501";

is the same as

$test="my name is Birdie501"

but it is in 2 lines (more clear) !!!??

Hey professionals please confirm :)

Velocd
07-02-2002, 09:47 PM
interesting...I think I get it then..
The reason why the developers put it on the second line was because the first line was getting too long, so they wanted to break it apart and put it on a new line. Organization was my first assumption.

Somebody confirm this please :D

(also if possible help in my first request would be nice ^_^)

Xenon
07-02-2002, 10:24 PM
it's correct
$test .="bla"; is equal to this: $test=$test."bla";
also same method:
$test +=4 is equal to $test=$test+4;

all getsomething functions in your php-files have also queries in it, for example the getpermissions(); function includes the queries to get the permissions out of the DB...