I am newbie in php scripting, 
I am used to using asp scripting
I get the result of my page but with no error message 
But Operator like * , + , or /   the  result is not valid result 
Variable $rat on my page it’s not work ……….
 
 
My database sample
_______________________________
Id  gid   kabupaten     etc..
 -----------------------------------------------------
1    0    x     x
2    1    x     x
3    0    etc
4    1
5    2
 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php
require('pagedresults.php');
$user="root";
$host="localhost";
$password="";
$db="test";
$cnx = @mysql_connect($host,$user,$password);
if(!$cnx) echo "ndak nyambung";
$jadi=mysql_select_db($db,$cnx);
$sqlcombo = "select distinct material from distribusi";
$hasil = mysql_query($sqlcombo);
$x=1;
 
                        $rs = new MySQLPagedResultSet("Select * from
distribusi where material like '%$cari%' or kabupaten like '%$cari%' or
jumlahpend like '%$cari%' or produksi like '%$cari%' or kebutuhan like
'%$cari%' order by kabupaten",8,$cnx);
            
 
 
?>
<html>
<head>
<title> </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#2A508F">
 
<center>
 
<?php while ($row = $rs->fetchArray()): 
 
if($row['gid']=0)
{
$rat = 110;                    // from this operator displayed with not
valid result
}
elseif($row['gid']=1)
{
$rat = 9.5;                     // from this operator displayed with not
valid result
}
else
{
$rat = 6.6;                     // from this operator displayed with not
valid result
}
 
 
?>
<tr bgcolor=white>
<td align=center bgcolor=white><a
href="confdelete.php?id=<?=$row['id']?>"><img src="images/del_topic.gif"
border="0" alt="Delete This Field"></a></td>
<td align=center bgcolor=white><a
href="edit-distribusi.php?id=<?=$row['id']?>"><img src="images/edit.gif"
border="0" alt="Edit This Field"></a></td>
<td align=center bgcolor=white><font color=black face=verdana
size=1px><?=$x++?></font></td>
<td align=center bgcolor=white><font color=black face=verdana
size=1px><?= $row['material']?></font></td>
<td bgcolor=white><font color=black face=verdana
size=1px><?=$row['kabupaten']?></font></td>
<td bgcolor=white><font color=black face=verdana
size=1px><?=$row['jumlahpend']?></font></td>
<td bgcolor=white><font color=black face=verdana
size=1px><?=$row['produksi']?></font></td>
<td bgcolor=white><font color=black face=verdana
size=1px><?=$kebutuhannye =((($row['jumlahpend'])* $rat ) / 1000
);?></font></td>  <----- here I print , I get an error value  
<td bgcolor=white><font color=black face=verdana  size=1px><?=$rationye
= ($row['produksi']/$kebutuhannye)?></font></td>
</tr>
<?php endwhile; ?>
<tr bgcolor=white>
<td colspan=9 align=right bgcolor=white><a href="add-data.php"><img
src="images/add.gif" border="0" alt="Add Data"></a></td>
</tr>
</table>
<p>
<font color=white face=verdana
size="1"><?=$rs->getPageNav("id=$id")?></font></p>
<div align="left">
 
</div>
</center>
</body>
</html>
 


Reply via email to