Lost Password?


Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-22-2008, 06:56 AM
fimmy fimmy is offline
Newbie
 
Join Date: Apr 2008
Posts: 3
Rep Power: 0
fimmy is on a distinguished road
Default PHP and MYSQL help needed

The code is link from the Find a property page once the user select a property it should bring then to the discount page but the dicount doesnt wrk and i really dnt no why pls any help will be greatful


this code below is mt discount.php code
PHP Code:
<h1>M & K Townhouse Incorporation</h1>
      <ul id="nav">
         <li class="h"><a href="index.php">Home</a></li>
        <li class="a"><a href="purchase.php">Find a Property</a></li>
        <li class="c"><a href="discount.php">Discount</a></li>
        <li class="p"><a href="payment.php">Payment</a></li>
        <li class="d"><a href="summary.php">Summary</a></li>
      </ul>
    </div>
    <!-- /header -->
    <div id="content">
      <h4>Discount</h4>
     <div id="text">

    <?php 



       $id 
$_GET['id'];

       
$_SESSION['p'] = $_GET['id'];; // Set name = form variable $name
    
    //echo $_SESSION['p'];
    
if ($_SESSION['p']!="")
       {
         
    echo 
"<div id='text1'>";
    echo 
"You have selected property ";
      
       echo 
"$id";
    echo 
"<br />"

        
$con mysql_connect("localhost","xxxxxxxx","xxxxxxx");
    if (!
$con)
       {
        die(
'Could not connect: ' mysql_error());
       }
mysql_select_db("xxxxxxxxx"$con);
     
        
$result1 mysql_query("SELECT propertyprice FROM property WHERE propertyid = $id");

    while(
$row mysql_fetch_array($result1))
      {
     echo 
'The original property price Â£' number_format($row['propertyprice'],2);
     
$price $row['propertyprice'];
     echo 
"<br />";
      }
     

        
$upgradedprice $propertyprice;

    
$propertyoption1 $_POST["Option_1"];
    
$propertyoption2 $_POST["Option_2"];
    
$propertyoption3 $_POST["Option_3"];


    if ((
$propertyoption1=='centre_surround') && ($propertyoption2=='fully_carpeted') && ($propertyoption3=='early_completion')){
        echo 
"<br />";
        echo 
"You have chosen a central surround system, fully carpeted bedroom and early completion";
        echo 
"<br />";
    
        
$upgradedprice $propertyprice-((1.2/100)*($propertyprice+5500+2950));
        
$upgradedpriceF number_format($upgradedprice,2);
        echo 
'The new property price after options have been added Â£' $upgradedpriceF;
        echo 
"<br />";
        echo 
"<br />";
        echo 
"Click proceed to continue to transaction";
        
$propertyoption1="checked";
        
$propertyoption2="checked";
        
$propertyoption3="checked";
        echo 
"<br />";
       } else if ((
$propertyoption1=='centre_surround') && ($propertyoption2=='fully_carpeted')) {
        echo 
"<br />";
        echo 
"You have chosen a central surround system and fully carpeted bedroom";
        echo 
"<br />";
        
        
$est1 $propertyprice - ((1.2/100)*($propertyprice+5500+2950));
        
$est2 $propertyprice - ((0.45/100)*($propertyprice+5500));

        if (
$est1 est2) {
            
$upgradedprice $est1;
        } else if (
$est2 $est1) {
            
$upgradedprice $est2;
        } else {
            
$upgradedprice $est1;
        }

        echo 
'The new property price after options have been added Â£' number_format($upgradedprice,2);
        echo 
"<br />";
        echo 
"<br />";
        echo 
"Click proceed to continue transaction";
        
$opt1="checked";
        
$opt2="checked";
        echo 
"<br />";
    } else if ((
$propertyoption1=='centre_surround') && ($propertyoption3=='early_completion')) {
        echo 
"<br />";
        echo 
"You have chosen a central surround system and early completion";
        echo 
"<br />";
        
        
$upgradedprice $propertyprice - ((1.2/100)*($propertyprice+5500));
        echo 
'The new property price after options have been added Â£' number_format($upgradedprice,2);
        echo 
"<br />";
        echo 
"<br />";
        echo 
"Click proceed to continue transaction";
        echo 
"<br />";
        
$opt1="checked";
        
$opt3="checked";
    } else if ((
$propertyoption2=='fully_carperted') && ($propertyoption3=='early_completion')) {

        echo 
"<br />";
        echo 
"You have chosen a fully carpeted bedroom and early completion";
        echo 
"<br />";
        
        
$upgradedprice $propertyprice - ((1.2/100)*($propertyprice+2950));
        echo 
'The new property price after options have been added Â£' number_format($upgradedprice,2);
        echo 
"<br />";
        echo 
"<br />";
        echo 
"Click proceed to continue transaction";
        echo 
"<br />";
        
$opt2="checked";
        
$opt3="checked";
    } else if (
$propertyoption1=='centre_surround') {
        echo 
"<br />";
        echo 
"You have choosen a central surround system";
        echo 
"<br />";
        
        
$upgradedprice = ($propertyprice 5500);
        echo 
'The new property price after option have been added Â£' number_format($upgradedprice,2);
        echo 
"<br />";
        echo 
"<br />";
        echo 
"Click proceed to continue transaction";
        echo 
"<br />";
        
$opt1="checked";
    } else if (
$propertyoption2=='fully_carpeted') {
        echo 
"<br />";
        echo 
"You have chosen a fully carpeted bedroom";
        echo 
"<br />";
        
        
$upgradedprice = ($propertyprice 2950);
        echo 
'The new property price after options have been added Â£' number_format($upgradedprice,2);
        echo 
"<br />";
        echo 
"<br />";
        echo 
"Click proceed to continue transaction";
        echo 
"<br />";
        
$opt2="checked";
    } else if (
$propertyoption3=='early_completion') {
        echo 
"<br />";
        echo 
"You have chosen an early completion";
        echo 
"<br />";
        
$upgradedprice $propertyprice - ((1.2/100)*($propertyprice));
        echo 
'The new property price after options have been added Â£' number_format($upgradedprice,2);
        echo 
"<br />";
        echo 
"<br />";
        echo 
"Click proceed to continue transaction";
        echo 
"<br />";
        
$opt3="checked";
    } else {
        echo 
"<br />";
           echo 
"Choose from the options or click proceed";
        echo 
"<br />";
    }    

    echo 
"<br />";
    

    echo 
"<form action='$php_self' method='post'>";
    echo 
"central surround system Â£5500 <input type='checkbox' name='Option_1' value='centre_surround' $opt1>";
    echo 
"<br />";
     echo 
"fully carpeted bedroom Â£2950 <input type='checkbox' name='Option_2' value='fully_carpeted' $opt2>";
    echo 
"<br />";
    echo 
"early completion <input type='checkbox' name='Option_3' value='early_completion' $opt3>";
    echo 
"<br />";
    echo 
"<br />";
    echo 
"<input type='submit' value='Add option(s)'>";
    echo 
"</form>";

    echo 
"<br />";
       echo 
"<br />";
    echo 
"<br />";
       echo 
"<br />";
    echo 
"<form action='payment.php' method='post'>";
    
    echo 
"<input type='submit' value='proceed'>";
    echo 
"</form>";    

      
mysql_close($con);
       }
       else{
         echo 
"Please choose a property";
       }
     </
div>
    <!-- /
content -->
    <
div id="footer">
      <
div id="ftinner">
        <
div class="ftlink ">
          <
p id="copyright">© 2008. All Rights Reserved. <br/>
            
Designed by XXXXXXXXXXXXXXXXX </a></p>
        </
div>
      </
div>
    </
div>
    <!-- /
footer -->
  </
div>
</
div>
</
body>
</
html>

Last edited by Jaan; 04-26-2008 at 04:23 AM. Reason: Use code tags when you're posting your codes!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 04-26-2008, 10:23 AM
ggggqqqqihc ggggqqqqihc is offline
Newbie
 
Join Date: Apr 2008
Posts: 9
Rep Power: 0
ggggqqqqihc is on a distinguished road
Default Re: PHP and MYSQL help needed

Here:
PHP Code:
    while($row mysql_fetch_array($result1))
      {
     echo 
'The original property price Â£' number_format($row['propertyprice'],2);
     
$price $row['propertyprice'];
     echo 
"<br />";
      } 
mysql_fetch_array() returns a normal array, not an associative array. i.e. if you use mysql_fetch_array, you must get data by $row[0], $row[1]... Otherwise, you need to use mysql_fetch_assoc(), it returns an associative array so I think it will work.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-27-2008, 04:06 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,583
Last Blog:
Web slideshow in JavaS...
Rep Power: 76
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: PHP and MYSQL help needed

Excellent advice, ggggqqqqihc. +rep given.
__________________


Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-28-2008, 01:13 AM
v0id's Avatar   
v0id v0id is offline
Retired
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,627
Last Blog:
CherryPy(thon)
Rep Power: 28
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default Re: PHP and MYSQL help needed

Good to see some people are still using the reputation system. We should get everybody to use it.
__________________
05-03-2007 - 11-13-2008
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-28-2008, 01:56 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,583
Last Blog:
Web slideshow in JavaS...
Rep Power: 76
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: PHP and MYSQL help needed

I was sort of hoping that if I gave rep, maybe other people will rep me back. At least that's what the message box says.
__________________


Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: Storing Images in MySQL with PHP Jordan PHP Tutorials 13 09-23-2008 07:11 PM
Tutorial: PHP to MySQL Jordan PHP Tutorials 9 09-05-2008 01:12 PM
Php and MySQL help? phpforfun PHP Forum 14 03-07-2008 10:01 AM
PHP Help NEEDED! jimpossible2k Request Services (Paid) 0 01-12-2008 11:10 AM
MySQL Resources dirkfirst Database & Database Programming 1 05-25-2006 03:31 AM


All times are GMT -5. The time now is 06:14 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads