Unstoppable Domains

A few PHP questions.

Spaceship Spaceship
Watch

TwiztedFake

Established Member
Impact
1
First
I know the standard format for date in MySql is yyyy-mm-dd but what is the standard format for time. Is it hh:mm:ss?

Second
I working on an articles section and plan track the number of views for each article how can I do this. Would something like $views = $views + 1 work?

The last question.
How can I display the number queries executed and the time it took for the server to build the page.

Thanks in advance to whomever can help me out.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
1. Yes, HH:MM:SS (I'm pretty sure)
2.
Code:
mysql_query("UPDATE articles SET views = views + 1 WHERE id = 1");
3. Use a variable. $query_count.. whenever you do a query just increment it.

And finally, maybe something like this
PHP:
<?php

$time = explode(" ", microtime());
$time = $time[1] + $time[0];
$start = $time;

//Your code.....


$time = explode(" ", microtime());
$time = $time[1] + $time[0];
$finish = $time;
$totaltime = ($finish - $start);
printf("Page loaded in %f seconds.", $totaltime);

?>

Hope that helps. :)

-Eric
 
Last edited:
0
•••
Thanks! Should help out a bunch since I'm tweaking my original code for a site.
 
0
•••

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back