Jump to content

[SOLVED] Improve my code


Voodoo Jai

Recommended Posts

Hi all thanks for the help with my coding Q's, can you help me improve my code now. I have also been told that there may  security issues with extracting data from my db, regarding malicious viruses implanted into it. Is only the VARCHAR side of the data stored only vulnerable to this type of attack.

 

************************************************


echo "<tr>";
  echo "<td>";
   echo "Sat";
echo "</td>";
        echo "<td>";
echo "<div align=\"right\">";
        $row_Takeaway['Sat_hr_1'];

//IF  data in a specific col then SHOW data for a specific col

        $f = $row_Takeaway['Sat_hr_1'];
						    
if ($f <> NULL) 
   {
   echo "-";
   echo $row_Takeaway['Sat_min_1'];
   }
else
   {
   echo "Closed";
   }
						   
           echo "</div>";
   echo "</td>";
echo "</tr>";

 

if ($row_Takeaway['List_Type'] == 4 || $row_Takeaway['List_Type'] == 5) 
{
   echo"<tr>";
      echo"<td valign=\"top\">";
echo"<div align=\"left\">";
echo"<span class=\"style5\">";
echo"Free phone";
echo"</span>";						
echo"</div>";
echo"</td>";
        echo"<td valign=\"top\">";
echo"<div align=\"left\">";
echo $row_Takeaway['FreePhone'];
echo"</div>";
echo"</td>";
     echo"</tr>";

**************************************************

 

I think this code could be improved so any pointers much appreciated.

 

Jai

 

Link to comment
https://forums.phpfreaks.com/topic/83598-solved-improve-my-code/
Share on other sites

 

get rid off some echo's lol

<?php
if ($row_Takeaway['List_Type'] == 4 || $row_Takeaway['List_Type'] == 5) 
{

$x=$row_Takeaway["FreePhone"];

$takeaway=<<<EDOC
    <tr>
    <td valign="top">
<div align="left">
<span class="style5">
Free phone
</span>						
</div>
</td>
    <td valign="top">
<div align="left">
$x
</div>
</td>
    </tr>
EDOC;
echo $takeaway;
}
?>

 

get rid off some echo's lol

<?php
if ($row_Takeaway['List_Type'] == 4 || $row_Takeaway['List_Type'] == 5) 
{

$x=$row_Takeaway["FreePhone"];

$takeaway=<<<EDOC
    <tr>
    <td valign="top">
<div align="left">
<span class="style5">
Free phone
</span>						
</div>
</td>
    <td valign="top">
<div align="left">
$x
</div>
</td>
    </tr>
EDOC;
echo $takeaway;
}
?>

 

 

Thats what I was thinking but was not sure. Mmmmmmmmmmmm all that coding for nothing LOL

 

Thanks for the help again

Jai

 

get rid off some echo's lol

<?php
if ($row_Takeaway['List_Type'] == 4 || $row_Takeaway['List_Type'] == 5) 
{

$x=$row_Takeaway["FreePhone"];

$takeaway=<<<EDOC
    <tr>
    <td valign="top">
<div align="left">
<span class="style5">
Free phone
</span>						
</div>
</td>
    <td valign="top">
<div align="left">
$x
</div>
</td>
    </tr>
EDOC;
echo $takeaway;
}
?>

 

How do I find more info, explanation of what this EDOC does. It makes it all lokk more tidier and I have a lot of code that I need to do this conversion to.

Jai

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.