Minggu, 21 Juli 2013

PHP Indonesia - Facebook: #tips-php Teknik potong script php Sebaiknya kode...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
#tips-php Teknik potong script php Sebaiknya kode...
Jul 22nd 2013, 03:57, by Erwin Sholeh Siregar

Erwin Sholeh Siregar 3:57am Jul 22
#tips-php
Teknik potong script php
Sebaiknya kode php hanya untuk proses php dan jika kode html tidak perlu di proses atau dicetak melaui code php. Contohnya berikut :
<?php
$q=mysql_query("SELECT * FROM berita");
while($r=mysql_fetch_array($q)){
echo "<div class=judul>Judul : $r[judul]</div>";
echo "<div class=isi>Isi berita : $r[isi]</div>";
}
?>
Sebaiknya kode di atas menjadi seperti ini :
<?php
$q=mysql_query("SELECT * FROM berita");
while($r=mysql_fetch_array($q)){
$jd=$r["judul"];
$berita=$r["isi"];
?>
<div class="judul">Judul : <?=$jd?></div>
<div class="isi">Isi berita : <?=$berita?></div>
<?}?>

Chabib Nurozak 4:00am Jul 22
kenapa tidak
<?php
$q=mysql_query("SELECT * FROM berita");
while($r=mysql_fetch_array($q)){
?>
<div class="judul">Judul : <?=$r["judul"];?></div>
<div class="isi">Isi berita : <?=$r["isi"];?></div>
<?}?>

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar