You are here: Re: Confused by mysqli « PHP Programming Language « IT news, forums, messages
Re: Confused by mysqli

Posted by Erwin Moller on 07/05/06 11:13

Dodger wrote:

> Okay, background... yes, I am another of those evil, spurned, damnable
> Perl mongers, but I'm not trying to start a flamewar, I'm juust tryung
> to understand something...

Hi Dodger,

Other helped you with the msql part, but I want to make 1 remark on your
next comment:

>
> I can write a script in Perl like so, and it's pretty to me (and the
> using of the heredocs I think does defend perl against many arguments
> withthe HTML being all escaped and explicit returns and stuff -- which
> I can see... 'print "<p class=\"text\">stuff</p>\n";' is terrible to
> me to.. so I use heredocs), and simple, and fast under mod_perl...
>

Only people who like to write unreadable code use syntax like that.
consider:
print "<p class=\"text\">stuff</p>\n";
and
<p class="text">stuff</p>

The latter is the usual normal way if you first jump out of the PHP-tags,
which every experienced PHP-coder with a sane mind does, for sake of
readability.
If you need to jump back to get some variable, do this:
[just an example that uses ADODB-lib.]

<table>
<tr>
<td>
userid
</td>
<td>
firstname
</td>
<td>
lastname
</td>
</tr>

<?php
$SQL = "SELECT userid, firstname, lastname FROM tbluser;";
$RS = $con->Execute($SQL)->getArray;
for($i=0;$i<count($RS);$i++){
$row = $RS[$i];
?>
<tr>
<td>
<?php= $row["userid"] ?>
</td>
<td>
<?php= $row["firstname"] ?>
</td>
<td>
<?php= $row["lastname"] ?>
</td>
</tr>

<?php
}
?>
</table>


I think that makes great readable code, both from a HTML perspective as from
a PHP perspective.
Don't use print and echo for HTML, unless you have some compelling reason.

just my 2 cent.

Regards,
Erwin Moller

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация