A few PHP questions.

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Spacemail by SpaceshipSpacemail by 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
Close
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
Close
Thanks! Should help out a bunch since I'm tweaking my original code for a site.
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back