Jump to content

Will this slow down my php?


Gayner

Recommended Posts

Prettty much this is all in my index.php

 

<?php
if (isset($_GET['view'])) {
echo $_GET['view'];

exit;
}
if (isset($_GET['Id'])) {

// Get all the data from the "example" table
$result = mysql_query('SELECT id,user_name,date FROM users WHERE id = '.$_GET['Id'].'') 
or die(mysql_error());  

// keeps getting the next row until there are no more to get
while($data = mysql_fetch_array($result)) {
// Print out the contents of each row into a table
$username = $data['user_name'];
echo "<title> Viewing User: $username</title>";
echo '<a href=\'index.php\'>Pray4Life</a> -> Viewing Profile: <a href=./?Id='.$data['id'].'>'.$username.'</a>';
} 
exit;
}
else {
navbar("<a href=./?>Pray4Life</a>", "Prayer List", "Prayer Center -> Main"); 
}
?>
<fieldset><legend>Prayer List</legend>
<table class="ftb">
<colgroup align="left">
<col width="30%" align="left"></col>
<col width="12%" align="left"></col>
<col width="7%"></col>
<col width="7%"></col>
<col width="18%" align="left"></col>
</colgroup>
<tr>
<th align='left'>Prayer Title</th>
<th>Author</th>

<th>Replies</th>
<th>Views</th>
<th>Last Reply</th>
</tr>

<?php

$query="SELECT `id`,title,time,level,nameid,name,prays FROM prays ORDER by id DESC";
$result=mysql_query($query);

while($row=mysql_fetch_array($result))
{
if (!$row['prays'])
$prays = "0";
else
$prays = $row['prays'];
if (!$row['nameid']) 
$l = ''.$row['name'].'';
else
$l = '<a href="?Id='.$row['nameid'].'">'.$row['name'].'</a>';
$color_one = ' class="bc1"'; 
   $color_two = ''; 
   static $i = 0;
   $color = ($i % 2) ? $color_one : $color_two;
   $i++;
echo '<tr'.$color.'>
   <td><a href="?view='.$row['id'].'"><b>'.$row['title'].' </b></a> ('.$prays.' Prayers) </td>

   <td>'.$l.'<br><span class="desc">'.$row['time'].'</span></td>
   <td>15,117</td>
   <td>448,857</td>
   <td class="lc"><a href="user.php?i=219525">Arsenic_Touch</a><br><span class="desc">1 hours, 2 minutes ago</span></td>
</tr>';

}

mysql_free_result($result);
?>
</table></tr>
</fieldset>

 

it works fine and i am used to wear all my code is at but wil this type of coding slow down php? i mean not coding but like if they all bunched up?

Link to comment
https://forums.phpfreaks.com/topic/182750-will-this-slow-down-my-php/
Share on other sites

it works fine and i am used to wear all my code is at but wil this type of coding slow down php? i mean not coding but like if they all bunched up?

 

If you mean that you're worried this kind of compact coding will slow down the compiler: don't, it doesn't matter for the compiler how many whitespaces are in between or if you're using branches (when not needed ofcourse), he won't compile slower for that matter.

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.