Jump to content

How to add value in a field


tobitimac

Recommended Posts

Hi

 

i have the data below in my database, i will want the users to use a drop down that wont show a duplicate data in item field and if the user select an item it should the total number of the item from qty field.

 

HERE IS MY DATA

Item Qty

1055-2X 1471

1055-2X 2

1055-2X 4

1055-2X 0

1055-3X 413

1055-3X 0

1055-3X 0

1055-3X 0

1055-4X 15

1055-4X 0

1055-4X 0

1055-4X 0

1055-5X 28

 

WANTS THE DROP DOWN MENU TO SHOW

item

1055-2X

1055-3X

1055-4X

1055-5X

 

ONCE ANY ITEM IS SELECTED I WANT TO DISPLAY THE TOTAL SUM OF THE ITEM TO SHOW

for example if i select 1055-2X i want to show

 

item Qty

1055-2X 1477

 

Please any help?

 

here is my current script which shows everything.

 

<?

if(isset($select)&&$select!=""){

// Get records from database (table "name_list").
$result=mysql_query("select distinct from inventory where id='$select'");
while ($row=mysql_fetch_assoc($result)) {

echo"<b>";
echo "<tr><td style=\"font-size: 15px;\"><b>";
echo $row['itemNumber'];
echo "</td><td style=\"font-size: 15px;\"><b>";
echo $row['itemDesc'];
//echo "</td><td style=\"text-align: right;\"><b>";
echo "</td><td style=\"font-size: 15px; text-align: center;\"><b>";
echo $row['quantityHand'];
echo"</b>";

// End While loop
}
// End if statement.
}


$sql = "select * from inventory ORDER BY itemNumber ASC";
$result = mysql_query ($sql);


while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['itemNumber'];
echo "</td><td>";
echo $row['itemDesc'];
//echo "</td><td style=\"text-align: right;\">";
echo "</td><td style=\"text-align: center;\">";
echo $row['quantityHand'];
echo "</td></tr>";
}




?>

Link to comment
https://forums.phpfreaks.com/topic/234890-how-to-add-value-in-a-field/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.