ช่วยดู โค๊ดให้หน่อยค่ะ

เริ่มโดย Nato_One, 18 มกราคม 2013, 10:55:57

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

Nato_One

select sum(product.price)
from name , product , type
where product.type_id = type.type_id
and product.name_id = name.name_id
and product.product_id = '9'

ดูใน ฐานข้อมูลค่าที่ออกมาเป็น 12.52

แต่เวลา echo ค่าที่ออกมาคือ 12  ต้องแก้ยังไงค่ะ  ขอคำแนำนำ หน่อยค่ะ

jkscript

อ้างถึงจาก: Nato_One ใน 18 มกราคม 2013, 10:55:57
select sum(product.price)
from name , product , type
where product.type_id = type.type_id
and product.name_id = name.name_id
and product.product_id = '9'

ดูใน ฐานข้อมูลค่าที่ออกมาเป็น 12.52

แต่เวลา echo ค่าที่ออกมาคือ 12  ต้องแก้ยังไงค่ะ  ขอคำแนำนำ หน่อยค่ะ
ชนิดของข้อมูลที่เก็บใน DB คือชนิดแบบไหนครับ
DECIMAL( 12, 2 ) รึป่าว
[direct=https://buteasuperbaextract.blogspot.com]Butea Superba Extract[/direct]
[direct=https://thaibuteasuperba.blogspot.com]Butea Superba[/direct]
[direct=https://sharehost.wordpress.com]What is Butea Superba?[/direct]
[direct=https://bloggerthailand.wordpress.com]The Benefits of Butea Superba[/direct]
[direct=https://siamreviews.wordpress.com]Root power of Butea Superba![/direct]

Nato_One

อ้างถึงจาก: jkscript ใน 18 มกราคม 2013, 11:04:12
อ้างถึงจาก: Nato_One ใน 18 มกราคม 2013, 10:55:57
select sum(product.price)
from name , product , type
where product.type_id = type.type_id
and product.name_id = name.name_id
and product.product_id = '9'

ดูใน ฐานข้อมูลค่าที่ออกมาเป็น 12.52

แต่เวลา echo ค่าที่ออกมาคือ 12  ต้องแก้ยังไงค่ะ  ขอคำแนำนำ หน่อยค่ะ
ชนิดของข้อมูลที่เก็บใน DB คือชนิดแบบไหนครับ
DECIMAL( 12, 2 ) รึป่าว

Type = double   ค่ะ
echo  ค่าออกธรรมดาค่ะ

sorayuth

copy code มาดูดีกว่า

ถ้าไม่ได้ไปแปลงค่าอะไร มัน ไม่น่าจะเปลี่ยนค่านะ


ลองเอา sql ไป run ใน DB ตรงๆดูด้วยครับ ว่าค่าเท่ากันจริงหรือเปล่า

MapTwoZa

Good code quality Developer :D

Nato_One


EntServ

รับทำระบบ Streaming Server อยากได้เว็บสตรีมมิ่งหล่อๆ ติดต่อ PM ครับ