Jump to content


PHP code request


  • Please log in to reply
24 replies to this topic

#16 Sphere

Sphere

    The moth next to my brain is Bart, say hi to him if you like

  • Sponsor
  • PipPipPipPipPip
  • 2,355 posts
  • Location:*tap* Behind ya!
  • Interests:I'm a Dutchy, that means I'm not a German (which doesn't sound/look the same to me!) also, being a Dutchy means I'm an idiot... sort off!

    And I def. need to get a real life again... I'm bored with my current life, ideas can be pm'd to me!
  • Country:Dutchyland

Posted 24 March 2008 - 11:27 AM

I tried the ++ for each query, but it returns me a 0... for some unknown reason :cc_surrender:

The memory_get_usage I didn't know about though, gonna experiment with that tonight I think

#17 brewin

brewin

    Victory is mine!

  • Administrator
  • PipPipPipPipPip
  • 1,262 posts
  • Location:Missouri
  • Interests:Anything interesting.
  • Country:USA

Posted 24 March 2008 - 05:52 PM

View PostSphere, on Mar 24 2008, 06:27 AM, said:

I tried the ++ for each query, but it returns me a 0... for some unknown reason :cc_surrender:
Oh sorry, you need to specify global scope so it doesn't use the local version.

$num_queries = 0;

function Query() 
{
// query runs here
global $num_queries;
$num_queries++;
}


#18 Sphere

Sphere

    The moth next to my brain is Bart, say hi to him if you like

  • Sponsor
  • PipPipPipPipPip
  • 2,355 posts
  • Location:*tap* Behind ya!
  • Interests:I'm a Dutchy, that means I'm not a German (which doesn't sound/look the same to me!) also, being a Dutchy means I'm an idiot... sort off!

    And I def. need to get a real life again... I'm bored with my current life, ideas can be pm'd to me!
  • Country:Dutchyland

Posted 24 March 2008 - 06:03 PM

View Postbrewin, on Mar 24 2008, 06:52 PM, said:

Oh sorry, you need to specify global scope so it doesn't use the local version.

$num_queries = 0;

function Query() 
{
// query runs here
global $num_queries;
$num_queries++;
}

I should've known that myself even... :cc_surrender: :rofl_mini:

#19 banj0

banj0

    American Idle

  • Sponsor
  • PipPipPipPipPip
  • 1,537 posts
  • Location:Detroit
  • Country:States

Posted 24 March 2008 - 08:16 PM

The author of the Evolution CMS says that everything you need is in these 2 files.

Attached File  mysql.php   13.41K   3 downloads

Attached File  mysqli.php   12.72K   3 downloads

Hope that helps.

#20 Sphere

Sphere

    The moth next to my brain is Bart, say hi to him if you like

  • Sponsor
  • PipPipPipPipPip
  • 2,355 posts
  • Location:*tap* Behind ya!
  • Interests:I'm a Dutchy, that means I'm not a German (which doesn't sound/look the same to me!) also, being a Dutchy means I'm an idiot... sort off!

    And I def. need to get a real life again... I'm bored with my current life, ideas can be pm'd to me!
  • Country:Dutchyland

Posted 24 March 2008 - 08:53 PM

Ok, got the query count working, except sadly for the AJAX queries, because those build the page, then insert the query results....

Ah well, it works :cc_surrender:

The memory_get_usage() function doesn't work on my server, and replacement (exec-function) is not allowed (how surprisingly :rofl_mini: ), so I need a workaround for that still.


And yes, the folks at PHP-NUKE can write their code better then me.... but hey, I'm still in development of improvement!
I already cleaned up like 50% of the useless junk I wrote a year ago :(

#21 banj0

banj0

    American Idle

  • Sponsor
  • PipPipPipPipPip
  • 1,537 posts
  • Location:Detroit
  • Country:States

Posted 25 March 2008 - 03:26 AM

Sweet! Nice work Sphere!

Posted Image

0.18 seconds page load is pretty impressive. Are you using file cache or SQL cache?

#22 Sphere

Sphere

    The moth next to my brain is Bart, say hi to him if you like

  • Sponsor
  • PipPipPipPipPip
  • 2,355 posts
  • Location:*tap* Behind ya!
  • Interests:I'm a Dutchy, that means I'm not a German (which doesn't sound/look the same to me!) also, being a Dutchy means I'm an idiot... sort off!

    And I def. need to get a real life again... I'm bored with my current life, ideas can be pm'd to me!
  • Country:Dutchyland

Posted 25 March 2008 - 07:21 AM

SQL cache, 90% of the page is SQL :cc_surrender:

It doesn't count in the Youtube and external image load btw

Ow, don't mind the amount of SQL queries, that's a bug I haven't figured out yet.

#23 banj0

banj0

    American Idle

  • Sponsor
  • PipPipPipPipPip
  • 1,537 posts
  • Location:Detroit
  • Country:States

Posted 25 March 2008 - 08:15 AM

View PostSphere, on Mar 25 2008, 03:21 AM, said:

SQL cache, 90% of the page is SQL :cc_surrender:

Interesting. I disable my server cache to ease load but I may have to rethink that. Thx.

Quote

Ow, don't mind the amount of SQL queries, that's a bug I haven't figured out yet.

I'm averaging 52 queries per page for a forum. It's usually 0.9 to 1.3 seconds per page load. How many tables are you carrying?

#24 Sphere

Sphere

    The moth next to my brain is Bart, say hi to him if you like

  • Sponsor
  • PipPipPipPipPip
  • 2,355 posts
  • Location:*tap* Behind ya!
  • Interests:I'm a Dutchy, that means I'm not a German (which doesn't sound/look the same to me!) also, being a Dutchy means I'm an idiot... sort off!

    And I def. need to get a real life again... I'm bored with my current life, ideas can be pm'd to me!
  • Country:Dutchyland

Posted 25 March 2008 - 09:23 AM

View Postbanj0, on Mar 25 2008, 09:15 AM, said:

Interesting. I disable my server cache to ease load but I may have to rethink that. Thx.
I'm averaging 52 queries per page for a forum. It's usually 0.9 to 1.3 seconds per page load. How many tables are you carrying?
Should be 3 tables in total, iirc

Well, the SQL chaching does increase server loads, but speeds up the page load when the server can handle it. If the server can't handle big caches very well, you'd better not use it :cc_surrender:

But for proof that there's some sort of error with the query count, check the photoalbum, it's completely AJAX, no SQL query whatsoever, and it still says 32 queries...

#25 banj0

banj0

    American Idle

  • Sponsor
  • PipPipPipPipPip
  • 1,537 posts
  • Location:Detroit
  • Country:States

Posted 26 March 2008 - 05:13 AM

View PostSphere, on Mar 25 2008, 05:23 AM, said:

But for proof that there's some sort of error with the query count, check the photoalbum, it's completely AJAX, no SQL query whatsoever, and it still says 32 queries...

That is pretty weird.

As for the cache thing, I think I'm gonna turn on file caching and then try SQL and compare the 2. Might as well load it up and see how she flies. Plus it's shared so what the heck do i care, lol.

Your site is looking good bro! Nice job!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users