i want get value in two colums product_weight,product_weight_uom in jos_vm_product table,
i want display price in mod virtualmart similar :price /weight - weight unit
ex : 50.000 / 3 kg
my code
Quote
<?php
$sql="SELECT product_weight,product_weight_uom FROM `jos_vm_product` WHERE product_id = '$product_id'";
$query=mysql_query($sql);
if(mysql_num_rows($query) == 0)
{
echo "Chua co du lieu";
}
else
{
while($row=mysql_fetch_array($query))
{
echo $row[product_weight] ." - ".$row[product_weight_uom]."<br />";
}
}
?>
now i want put if product_weight,product_weight_uom = 0 will echo "null"
Quote
<?php
$sql="SELECT product_weight,product_weight_uom FROM `jos_vm_product` WHERE product_id = '$product_id'";
$query=mysql_query($sql);
if(mysql_num_rows($query) == 0)
{
echo "Chua co du lieu";
}
else
{
while($row=mysql_fetch_array($query))
{
if ($row[product_weight]=0||$row[product_weight_uom]=0)
{
echo " null";
}
else {
echo $row[product_weight] ." - ".$row[product_weight_uom]."<br />";
}
}
}
?>
with some product not set value product_weight,product_weight_uom in virtualmart
but when i run it print "0" instead "null"
any body help me
soory my english so bad !!
thanks for all!!
thanks for alll , i fixed it and working wel :D :D
Quoteif($row[product_weight]==0)
that correct