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
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;
}
?>

Link to comment
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;
}
?>

 

 

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

 

Thanks for the help again

Jai

Link to comment
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;
}
?>

 

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

Link to comment
Share on other sites

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.