Rabu, 14 Agustus 2013

PHP Indonesia - Facebook: [ask] kok ini saya bikin web forum sederhana, tapi...

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. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
[ask] kok ini saya bikin web forum sederhana, tapi...
Aug 14th 2013, 07:31, by Ashari Muhammad

Ashari Muhammad 7:31am Aug 14
[ask]
kok ini saya bikin web forum sederhana, tapi nama user yang ngepot ga mau keluar? saya udah coba gimana", tanya sana sini, masih belum bisa. mohon dibantu.
script untuk awalnya kan gini :
<?
//ambil nama pengguna dari database
include "koneksi.php" ;

$query = "SELECT * FROM user_login WHERE email='".$_SESSION['user_forum']."'" ;
$hasil = mysql_query($query) ;
$cek = mysql_fetch_array($hasil) or die(mysql_error() ) ;

echo " ".$cek['first_name'] ;
echo "<br><a href='logout.php'>Logout?</a>" ;
?>

terus untuk memunculkan gimana postingnya dsb kan gini :
<?
include_once ("koneksi.php") ;

//ambil data dari tabel
$query = mysql_query("SELECT * FROM topic order by post_date DESC") or die(mysql_error() );
while($hasil = mysql_fetch_array($query)){
//tampilin topik
echo "<font facce='verdana' size='+1' color='green'>".$hasil['title']."</font><br>" ;
//dapetin nama user
$query1 = mysql_query("SELECT CONCAT_WS(' ','first_name','last_name') as name_1 FROM user_login WHERE email='".$hasil['post_by_user']."'") or die(mysql_error()) ;
$hasil1 = mysql_fetch_array($query1) ;

echo "Diposkan oleh :".$hasil1['name_1']."<br>" ;
//tampilin tanggal
echo "Diposkan tanggal :".$hasil['post_date']."<br><br>" ;
//tampilin deskripsi
echo $hasil['description'] ;
echo "<br><hr>" ;
}
?>

dan hasilnya gini : :(

Gunawan Mujur Wibisono 7:38am Aug 14
perhatikan model forum yg ini http://www.secchan.net/flying/res/2321.html
trus km perhatikan link2nya.. semoga berhasil

Ahmad Hajar 7:47am Aug 14
Cek query concat mu om .. itu yg mau di gabung string ato field .

Zeihan Aulia 7:53am Aug 14
concatnya jangan dikasi kutip nanti jadi string kaya gitu, CONCAT_WS(' ',first_name,last_name)

Zeihan Aulia 7:56am Aug 14
ref: http://www.w3resource.com/mysql/string-functions/mysql-concat_ws-function.php #concat_ws

Ashari Muhammad 7:56am Aug 14
jadi tanpa kutip?
oke makasih, berhasil. makasih ya info" nya. :D

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