CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

View: 2349|Reply: 5

mysql n php

[Copy link]
Post time 6-3-2008 11:22 AM | Show all posts |Read mode
mcm mana kta nk kira harga n nk msk dlm table..
cth kta ada table barang n jualan..
dlm table barang ada harga seunit shj..

dlm table jualan ad kuantiti dan barang yang ingin dibeli..kalu ikut logic harga jualan=harga* kuantiti..
harga tu ambik dr table brg...cm ner kta nk relate kn dua table tu...
Reply

Use magic Report


ADVERTISEMENT


Post time 6-3-2008 11:43 AM | Show all posts
aku xsure betul ke x..just try je ek..jangan gelak tau..

select b.harga, j.barang,j.kuantiti
from barang b, jualan j
where j.barang = kuantiti *  harga
Reply

Use magic Report

 Author| Post time 6-3-2008 12:19 PM | Show all posts
kalu logic mmg btul tp kalu dlm php or mysql bleh ker bt cm tu...
Reply

Use magic Report

Post time 6-3-2008 03:33 PM | Show all posts
Originally posted by nedya_fhs at 6-3-2008 12:19 PM
kalu logic mmg btul tp kalu dlm php or mysql bleh ker bt cm tu...


eh..itu sql pnye statement la dik..xtau la plak aku kalo xbleh,,
Reply

Use magic Report

Post time 6-3-2008 10:25 PM | Show all posts

Reply #1 nedya_fhs's post

info:
table barang -> namabarang, hargaseunit.
table jualan -> namabarang, kuantiti.

SELECT barang.hargaseunit, jualan.kuantiti FROM barang, jualan WHERE barang.namabarang=jualan.namabarang

$jumlah=$row[barang.hargaseunit] * $row[jualan.kuantiti];

ps://untuk relatekan dua table, kena ada data yang sama dalam kedua-dua table. the rest awak fikirkan ek  ... website untuk rujukan www.escapez.net
Reply

Use magic Report

 Author| Post time 8-3-2008 09:18 PM | Show all posts
thanks ...hehehe
Reply

Use magic Report

Follow Us
You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

7-1-2025 06:57 AM GMT+8 , Processed in 0.124216 second(s), 19 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list