Fail to pass value
Posted: Thu Sep 16, 2010 10:24 pm
This time I face pass value problem again, however I think that I had pass the value though.
For the same function, I just pass the value num from other page it can wok as well, BUT in this case it doesn't work.
May be I use max function?? Anyone have idea on it??? Thanks if you guy could help me, I appreciate it.
Code: Select all
$num=$_POST['num'];
for ($i=1; $i<=$num; $i++)
{
$temp = $_POST["eid$i"];
$res2 = mysql_query("select max( equip_id ) from equip where equip_name = '$temp' group by equip_name") or die (mysql_error());
$eq_id = mysql_fetch_array($res2);
$k = $eq_id['max( equip_id )'];
$storage_capacity_required = ceil($_POST["scr$i"]);
// Calculate the hosting charges
$sqlA = mysql_query("select * from application where app_id = '$app_id'") or die (mysql_error());
$resA = mysql_fetch_array($sqlA);
$sqlD = mysql_query("select * from dchc where equip_id = '$k'") or die (mysql_error());
$resD = mysql_fetch_array($sqlD);
$w = $x = $y = $z = 0;
$w += number_format(round(((($resD[hw_sw_ssc]/$resD[years_armotize_ssc])/$resD[total_cus]) * $_POST[no_concurrent_user]),1), 2, '.', '');
$x += number_format(round(($resD[server_arc]/$resD[total_cus]) * $_POST[no_concurrent_user],1), 2, '.', '');
$y += number_format(round(($resD[amc]/$resD[total_cus]) * $_POST[no_concurrent_user],1), 2, '.', '');
$z += number_format(round(($resD[osc]/$resD[total_cus]) * $_POST[no_concurrent_user],1), 2, '.', '');
//insertig the hosting charges value into the db.
$sql2="insert into equip_app (app_id,equip_id,storage_capacity_required, app_ssc, app_arc, app_amc, app_osc)
values('$app_id', '$k', '$storage_capacity_required', '$w', '$x', '$y', '$z')";
if(!mysql_query($sql2, $con))
{
die('Error: ' . mysql_error());
}May be I use max function?? Anyone have idea on it??? Thanks if you guy could help me, I appreciate it.