This topic is locked

what would cause first number to be read but..

2/17/2009 3:10:26 PM
PHPRunner General questions
C
chaintm author

see below, I made it easier to understand.

C
chaintm author 2/17/2009

My database is set to int for these fields, so i am sort of cluesless why this below is not working correctly.
total_qty is only adding first digits in each event(order) that is entered. So a number of 1-9 works fine, going 10-higher gives only the first digit value and adds that in the sum total of all orders.
Excample: One order at 20 and another at 33 total_qty = 5
$rs5["ItemStockPhys"] works fine and uses the value 300 that i set it too.
//===========query from event_times for dates/inventory avaliblity when item is found in another order==================//

{

$str1 = "select event_time_start,event_time_end from event_times where Order_ID=".$_SESSION[$strTableName."_masterkey1"];

$rsh1 = db_query($str1,$conn);

while ($data1= db_fetch_array($rsh1))
$str3 = "select sum(Qty_Order) as total_qtyfrom event_times where Order_ID!=".$_SESSION[$strTableName."_masterkey1"]."

and Item_ID=".$values["ItemID"]."

and ".$data1["event_time_start"]." >= event_time_start

and ".$data1["event_time_start"]." <= event_time_end

and status ='1'

or Item_ID=".$values["ItemID"]."

and ".$data1["event_time_end"]." >= event_time_start

and ".$data1["event_time_end"]." <= event_time_end

and status ='1'

or Item_ID=".$values["ItemID"]."

and ".$data1["event_time_start"]." <= event_time_start

and ".$data1["event_time_end"]." >= event_time_end

and status ='1'";



$hrs3 = db_query($str3,$conn);

$rs3 = db_fetch_array($hrs3);

$data3 = $rs3['total_qty'];

$str5 = "select ItemStockPhys from items where ItemID=".$values["ItemID"];

$hrs5 = db_query($str5,$conn);

$rs5 = db_fetch_array($hrs5);

$data5 = $rs5['total_qty2'];
$data6["temp_total"] = ($values["Qty_order"]+$data3["total_qty"]);
{

if ($data6["temp_total"] > $rs5["ItemStockPhys"])

{

echo "ORDERED";

echo "..";

echo $values["Qty_order"];

echo "..";

echo "Total of all orders";

echo "..";

echo $data3["total_qty"];

echo "..";

echo "Inventory Level";

echo "..";

echo $rs5["ItemStockPhys"];

echo "..";

echo "Ordered+Total of all orders";

echo "..";

echo $data6["temp_total"];

echo "..";

echo "<font color=red><bold><MIDDLE><CENTER><big><b>XX____XX____XXXX </b></big></bold></MIDDLE></CENTER></font>";

echo "<font color=yellow><bold><MIDDLE><CENTER><big><b>NO ITEMS LEFT IN INVENTORY FOR RESERVATION FOR DATES WITHIN THIS ORDER </b></big></bold></MIDDLE></CENTER></font>";

echo "<font color=white><bold><MIDDLE><CENTER><big><b> for this order, please select another item or goto list to edit current</b></big></bold></MIDDLE></CENTER></font>";

echo "<font color=red><bold><MIDDLE><CENTER><big><b>XX____XX____XX
XX </b></big></bold></MIDDLE></CENTER></font>";

return false;

}

}

}
Any help here would be appreciated, I have to be missing something simple, the bold areas are what I think might be the issue.

C
chaintm author 2/17/2009

Knew it was something simple.
$rs3["total_qty"]
is the correct value, using the other corrupted the data.
Thnx thou <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=37927&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' /> I will leave this up for those that might run into the same thing, salu!