Jump to content

best practice for high traffic site


fotobleu

Recommended Posts

the scenario is , i have a imaginary site that will get high traffic, what is best for performance, and best practice

 

lets say i have some data for each user such as (name, age, sex)

 

which is a wise way to process and store this data?

 

1st way

         

          create a object and serialize it to one field in a database, and always serialize it and unserialize it when i want to work with the data or

 

2nd way

 

          just store each piece of data in the database in it's own field, and always query what you need and work with it

 

thanks in advance, i've been coding for a while now, and im reading all this materials on different way of doing things, but i would like to find out the benefits of one way versus the other, if anyone has any good resources i could read where i can get info on benefits and best practices, please let me know, i will greatly apreciate it

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/75462-best-practice-for-high-traffic-site/
Share on other sites

great, thanks for the response, what about preparing the data for output in html

 

for ex:

 

is it good to build a huge string like this and then run it trough one echo statement

 

$echoStr .= '<div>some more html tags,some values from the db</div>';

$echoStr .= '<div>some more html tags</div>';

$echoStr .= '<div>some more html tags</div>';

$echoStr .= '<div>some more html tags</div>';

 

//the last statement in php tags

echo $echoStr;

 

or individual echos

 

echo '<div>some more html tags, saome values from the db</div>';

echo '<div>some more html tags</div>';

echo '<div>some more html tags</div>';

echo '<div>some more html tags</div>';

 

thanks

  • 3 weeks later...

I'd do

echo <<<EOF
<div>some more html tags, saome values from the db</div>
<div>some more html tags</div>
<div>some more html tags</div>
<div>some more html tags</div>
EOF;

 

YIKES

 

I would not put the HTML and the PHP in the same file.

 

But thats just me.

 

Check out http://smarty.php.net

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.