0

Good afternoon all,
The issue I am having is that when POST data values are looped through inside the while loop as each record is compared with the POST data and the database record for any changes.
For this test the data from the post is exactly correct. The if statment compares the data and displays this as not eaual when it is?
What I can see is happening from what I can see is that the out data when output is not in sync, but not sure how to resolve this
example
The data output fot the first loop potputs the following
Post data 33.30 - 32.40 DB Output
Post data 32.40 - 33.30 DB Output
The output should be like this when it is checked I am assuming.

Post data 33.30 - 33.30 DB Output
Post data 32.40 - 32.40 DB Output

Post Array data
This POST data needs to be compared to the recordes found in the Database using the while statement.

 `["ProductID"]=> array(2) { [0]=> string(5) "75849" [1]=> string(5) "75850" }` This is the two ID's
`["Net"]=> array(2) { [0]=> string(5) "33.30" [1]=> string(5) "32.40" }`

$productSQL = $Database->Execute("SELECT * FROM POProducts inner join PODepartments ON PODepartments.PODepartmentID = POProducts.PODepartmentID  inner join PONominalCodes ON PONominalCodes.PONominalCodeNumber = POProducts.POProductNominalCode   WHERE POID = " . $_GET['POID']. " ORDER BY POProductID ASC");
   while ($rowProduct = $Database->Records($productSQL)) {
   foreach($_POST['Net'] as $key) {// output the post array data
       if($key != $rowProduct['POProductNet']){//compare the results from the the  POST data and the Database output
            echo "<br /> Post data".$key ." - " . $rowProduct['POProductNet'];// display the result if the data is not equal and entually insert data into DB
         }// end if 
      }// end foreach
  }// end while

The data output fot the first loop potputs the following
Post data 33.30 - 32.40 DB Output
Post data 32.40 - 33.30 DB Output

this output looks like it is not comparing the correct output
If you require any additional information please let me know

Thanks
D

1
Contributor
0
Replies
24
Views
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.