davidjennings 0 Junior Poster in Training

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.