Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.