Jump to content

Recommended Posts

Hello,

 

Below is code that is not allowing some data to show on screen, and also not inserting data to database. But first I would like to correct the data not showing to screen and possibly that will solve my other issue. What thing I do not understand, is the below code works fine on a server running on (Linux 2.6.18-374.3.1.el5.lve0.8.44), (MySQL 5.0.92-community), and (PHP Version:    5.2.17 (Zend: 2.2.0)).

 

Code does not work correctly on (Linux 2.6.18-274.3.1.el5.centos.plus), (MySQL 5.0.77), (PHP Version:    5.1.6 (Zend: 2.1.0)), Just curious why it does not work here? Would like to know for my knowledge.

 

<?php

if (isset($_POST['Update']))
{

    $sppc_query_raw = "select * from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id";
    $sppc_query = tep_db_query($sppc_query_raw);
    while( $sppc = tep_db_fetch_array( $sppc_query ) ) {


     if ($sppc["customers_group_name"] != "Retail"){
//$sppc['customers_group_id']

    $c = "CG_".$sppc['customers_group_id'];

    $tmp = $_POST[$c];

    if ($tmp != 0)
    {

    $p = (100-$_POST[$c])/100;

    tep_db_query("delete from products_groups where customers_group_id = ".$sppc['customers_group_id']);




    tep_db_query ("insert into products_groups select '". $sppc['customers_group_id'] ."' as customers_group_id, ( " . $p . " * p.products_price) as customers_group_price, p.products_id from products p");



    }  //if not 0
    }  //if not Retail

    }



}


?>

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo "Special Pricing Discount Setup"; ?></td>
            <td class="specialPrice" align="right"> </td>
          </tr>
        </table></td>
      </tr>




      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top"><table border="0" width="100%" cellspacing="2" cellpadding="2">
              <tr class="dataTableHeadingRow">
                <td class="dataTableHeadingContent" align="left">
                <?php

                if (isset($_POST['Update']))
                {
                    echo "<center>Updated!</center>";
                }

                ?>
                 </td>

              </tr>
<?php


    $sppc_query_raw = "select * from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id";
    $sppc_query = tep_db_query($sppc_query_raw);

    while( $sppc = tep_db_fetch_array( $sppc_query ) ) {

?>

              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">
                 <td class="dataTableContent" align="left">

                  <?php

                  if ($sppc["customers_group_name"] != "Retail"){

                      echo $sppc["customers_group_name"];

                  }

                  if (isset($_POST['Update']))
                  {

                        if ($sppc["customers_group_name"] != "Retail"){

                        $c = "CG_".$sppc['customers_group_id'];

                        $tmp = $_POST[$c];

                        echo " Current Discount is $tmp%" ;


                        }
                  }
                  ?>


                  </td>

              </tr>

<?php
     }
?>
        </table></td>
      </tr>

      <tr>
       <td valign="top">
       <form action="" method="post">
        <table border="0" width="40%" cellspacing="0" cellpadding="2">

              <tr>
                <td class="smallText" align="left"> </td>
                <td> </td>
              </tr>
<?php

    $sppc_query_raw = "select * from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id";
    $sppc_query = tep_db_query($sppc_query_raw);
    while( $sppc = tep_db_fetch_array( $sppc_query ) ) {



    if ($sppc["customers_group_name"] != "Retail"){

?>

              <tr>
                <td class="smallText" align="left">Set New Percentage (%) Discount for <?=$sppc["customers_group_name"]?> :</td>
                <td><input name="CG_<?=$sppc['customers_group_id']?>" type="text" size="5" value="0"></td>
              </tr>

<?php
              }

     }
?>

              <tr>
                <td colspan="2" align="center"><input type="submit" name="Update" value="Update"></td>
              </tr>



        </table>
        </form>
       </td>
      </tr>

    </table></td>
<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->

 

I attached two images, Screen 1 is correct screen view, and Screen 2 is missing some of the data, this is on the current machine. I highlighted in yellow the missing data.

 

Thank you for all the help,

 

DB

 

Screen1.png

 

Screen2.png

 

Link to comment
https://forums.phpfreaks.com/topic/253421-help-understanding-code-not-working/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.