[nflug] PHP Syntax

Franklin Kumro Jr fkumro at gmail.com
Wed Dec 3 08:35:56 EST 2008


If you don't need interpolation you could use single quotes + concatation
print '<b> Post Date: '.$row['post_date'].'
<br>Posted By: '.$row['post_author'].'<br>Subject:
'.$row['post_title'].'<br>
</b>
<br><br>
'.$row['post_text'].'
<hr><br>';

On Wed, Dec 3, 2008 at 7:48 AM, Rob Dege <livemotion at gmail.com> wrote:

> two things that jump out at me:
>
> 1) <bold> is not a w3c compliant tag, you want to use <b> instead
>
> 2) You can make the code faster by running one print instead of the 8:
>
> print "<b>
> Post Date: $row['post_date']<br>
> Posted By: $row['post_author']<br>
> Subject: $row['post_title']<br>
> </b>
> <br><br>
> $row['post_text']
> <hr><br>";
>
> Other than that, it looks fine to me.
>
> -Rob
>
>
> On Wed, Dec 3, 2008 at 12:31 AM, Robert Wolfe <robert at muzzlethem.com>wrote:
>
>> Ok, I know that this is probably the wrong group to be doing this in but I
>> have a quick simple PHP question.
>>
>> I am working on a newsletter type PHP script and was wondering if the
>> following code snippet was indeed correct (I am not able to test it here on
>> my laptop just yet and I have not uploaded the code to my primary
>> development/production/test server).
>>
>> ::snip::
>>   // load data from the database and show data in the browser
>>   while($row = mysql_fetch_assoc($result))
>>       {
>>           print "<bold>" ;
>>           print "Post Date: {$row['post_date']} <br>";
>>            print "Posted By: {$row['post_author']} <br>";
>>            print "  Subject: {$row['post_title']} <br>";
>>            print "<br><br>";
>>            print "</bold>";
>>            print $row['post_text'];
>>            print "<HR><BR>";
>>       }
>>
>> :: end snip ::
>>
>> I am writing this small package using Zend Studio for Eclipse v6.0 on my
>> laptop which is running Unbuntu 8.10 Desktop.
>>
>> _______________________________________________
>> nflug mailing list
>> nflug at nflug.org
>> http://www.nflug.org/mailman/listinfo/nflug
>>
>
>
>
> --
> -Rob
>
> Ben Franklin Quote: "They that can give up essential liberty to obtain a
> little temporary safety deserve neither liberty nor safety."
>
> _______________________________________________
> nflug mailing list
> nflug at nflug.org
> http://www.nflug.org/mailman/listinfo/nflug
>
>


-- 
Frank
Shenanigans!!
I do the voodoo that I do do with sudo!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.nflug.org/pipermail/nflug/attachments/20081203/e320d0e7/attachment.html


More information about the nflug mailing list