SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    323
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    logical operator

    HTML Code:
    <form action='orderpplac.php' method='Post' class='shlistbar'>
        <table border='1'>
        <tr>
        <th>SHOP NAME</th>
        <th>PRODUCT NAME</th>
        <th>PRODUCT SIZE</th>
        <th>PRODUCT COLOUR</th>
        <th>PRODUCT QUANTITY</th>
        <th>PRICE</th>
        <th>TOTAL</th>
        <th></th>
        </tr>
    PHP Code:
    <?php
        
    // Get DB results and loop, outputting table rows with counter
        
    $pplresult mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());
       for (
    $i 0$row mysql_fetch_assoc($pplresult); $i++) {
        echo 
    "
        <tr>
        <td>"
    .htmlspecialchars($row['Sname'])."</td>
        <td>"
    .htmlspecialchars($row['Pname'])."</td>
        <td>"
    .htmlspecialchars($row['Psize'])."</td>
        <td>"
    .htmlspecialchars($row['Pcolour'])."</td>
        <td>
        <input type='text' name='item[
    $i][Pquantity]' id='Pquantity' value='".htmlspecialchars($row['Pquantity'])."' />
        <input type='hidden' name='item[
    $i][Pidno]' id='Pidno' value='".htmlspecialchars($row['Pidno'])."' />
        </td>
        <td>
        <input type='text' name='item[
    $i][Price]' id='Pquantity' value='".htmlspecialchars($row['Price'])."' readonly>
        </td>
        <td>"
    .htmlspecialchars($row['Tprice'])."</td>
        <td><a href='deleteproduct.php?del="
    .htmlspecialchars($row['Pidno'])."'>delete</a></td>
        </tr>"
    ;
        }
       
    $pplresult mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());
      while (
    $row mysql_fetch_assoc($pplresult)) 
       
    //echo $row['Pquantity'] * $row['Price'];
      
    {
       
    $totalPrices += $row['Tprice'];
        if(
    0.1*$totalPrices <= 50 )
        {
        
    $totalPrice = (0.1*$totalPrices +  $totalPrices);
        }
        else
       {
        
    $totalPrice 50 $totalPrices;
            }
            
      }
      
    //echo "$totalprice";
      
             
    ?>
    HTML Code:
    <tr>
                    <th>Total Price</th>
                    <th><?php echo $totalprice; ?></th>
                    
                </tr>
        <!--Close table and form-->
    
        </table>
        <input type='submit' name='submit1' value='UPDATE' />
        <input type='submit' name='submit2' value='SUBMIT' />
        </form>

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,192
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    It's nice you posted your code but what is your actual question?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •