Hi all,

Need help from all of you...

I am still a newbie, and wanna ask code to display mysql data based on username login. I try many time to change on this code :

$result=mysql_query('SELECT tb_hitung.Keterangan, tb_hitung.Debit, tb_hitung.Kredit FROM tb_hitung INNER JOIN tb_bulan ON tb_hitung.id_bulan=tb_bulan.id_bulan ORDER BY tb_hitung.id_hitung');

but always get error..

please help me on how to change this code based on username, only so data will display for the related person.

Thanks,

Leo

Recommended Answers

All 3 Replies

I tried this code, but its still not working:

$result=mysql_query('SELECT tb_hitung.nama, tb_hitung.Keterangan, tb_hitung.Debit, tb_hitung.Kredit FROM tb_hitung WHERE tb_hitung.nama='.$_SESSION['username'].' INNER JOIN tb_bulan ON tb_hitung.id_bulan=tb_bulan.id_bulan ORDER BY tb_hitung.nama');

Anyone can help??

Your query is missing single quotes around the username.

mysql_query(" SELECT * FROM table_name WHERE username='$yourUsername' ");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.