Help - Search - Members - Calendar
Full Version: Help With Php
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
Shoaulin
CODE
        <?php
      include('order.php');
    
      include('include/session.php');
    
      
    
    function addOrder($username, $logs, $lumber, $stone, $price) {

        round($logs, 0);

        round($lumber, 0);

        round($stone, 0);



        $logs_price = $logs * 3;

        $lumber_price = $lumber * 4;

        $stone_price = $stone * 7;



        round($logs_price, 0);

        round($lumber_price, 0);

        round($stone_price, 0);



        $price = $logs_price + $lumber_price + $stone_price;

  

        $con = mysql_connect("localhost", "146687", "######");

  

        if(!$con) {

              echo "died"

              die('Could not connect: ' . mysql_error())

        }

  

        $sql = "INSERT INTO orders (username, logs, lumber, stone, price) VALUES ($username, $logs, $lumber, $stone, $price)";

  

       if(mysql_query($sql,$con)) {

              echo "<font>Your order has been added</font>";

        }

       else {

              echo "<font>There was an error adding your order to the databse: </font>" . mysql_error();

        }  
      ?>
    
      <html>
    
      <head>
    
      <link rel="stylesheet" type="text/css"
    
      href="style.css" />
    
      <title>Add Your Order</title>
    
      </head>
    
      <body background="http://media.bigoo.ws/content/background/color_orang/color_orang_117.jpg">
    
      <?php
    
      
    
    
              
    
               addOrder($session->username, $_POST['logs'], $_POST['lumber'], $_POST['stone'], $price);
    
      /* User is logged in */
    
      if($session->logged_in){
    
      echo "<br><h3>You are logged in as <b>$session->username</b>.<br><br></h3>"
    
             ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>]   "
    
             ."[<a href=\"useredit.php\">Edit Account</a>]   "
    
                 ."[<a href=\"order.php\">Back</a>]   ";
    
         if($session->isAdmin()){
    
            echo "[<a href=\"admin/admin.php\">Admin Center</a>]   ";
    
         }
    
         echo "[<a href=\"index.html.php\">Logout</a>]";
    
        
    
         echo $logs;
    
         echo $lumber;
    
         echo $stone;

         echo $price;
  
         ?>
  
      </body>
  
      </html>


I have checked all the file names and they are all correct(for includes etc) but when I load the page I get a blank page. Can anybody help me find out why?
Thanks in advance smile.gif
wozzym
whats your url?
Shoaulin
Sorry for the trouble. I am an idiot and forgot to put in a } at the end XD
wozzym
working now then I assume?
Shoaulin
Yep.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.