GSR_WildCard
Member
- Joined
- Sep 27, 2007
- Messages
- 450
- Reaction score
- 0
Heyos, all.
Have a very weird thought I need answered.
Look at the following code snippets:
One uses multiple <?php tags while using HTML code for the rest while the other encapsulates the whole section under <?php and uses echo for HTML statements.
File is saved as .php
In theory, which has higher server performance overhead?
N.B. Pls excuse if the code is not up to industry standards. Just started learning web development as part of my course.
Have a very weird thought I need answered.
Look at the following code snippets:
<?php
require('connect.php');
$people = mysqli_query($con , "SELECT * FROM people WHERE people_id = '".$pplid."'");
$people_attrib = mysqli_fetch_array($people); ?>
<div class='peopleDisplay'>
<?php echo "<img src=http://graph.facebook.com/".$peopleID."/picture?type=large>";?>
<br>
<?php echo $people_attrib['first_name'] . ' ' . $people_attrib['last_name']; ?>
<br>
<?php echo $people_attrib['gender']; ?>
<br>
<?php
if (($people_attrib['location'] == NULL) || ($people_attrib['location'] == ''))
{
echo "Unknown location";
}
else
{
echo $people_attrib['location'];
}
?>
</div>
<?php
require('connect.php');
$people = mysqli_query($con , "SELECT * FROM people WHERE people_id = '".$pplid."'");
$people_attrib = mysqli_fetch_array($people);
echo "<div class='peopleDisplay'>";
echo "<img src=http://graph.facebook.com/".$peopleID."/picture?type=large>";
echo "<br>";
echo $people_attrib['first_name'] . ' ' . $people_attrib['last_name'];
echo "<br>";
echo $people_attrib['gender'];
echo "<br>";
if (($people_attrib['location'] == NULL) || ($people_attrib['location'] == ''))
{
echo "Unknown location";
}
else
{
echo $people_attrib['location'];
}
echo "</div>";
One uses multiple <?php tags while using HTML code for the rest while the other encapsulates the whole section under <?php and uses echo for HTML statements.
File is saved as .php
In theory, which has higher server performance overhead?
N.B. Pls excuse if the code is not up to industry standards. Just started learning web development as part of my course.
