PHP代码没有将数据输入数据库

0 php mysql

    $name = $_GET['fullname'];
    $phone = $_GET['phone'];
    $address = $_GET['address'];
    $size = $_GET['size'];
    $toppings = $_GET['toppings'];
    $delivery = $_GET['type'];



    mysql_connect ("localhost", "root", "") or die ('Error: ' . mysql_error());
    mysql_select_db ("pizzaorders");
    $query ="INSERT INTO orders (fullname, phone, address, size, toppings, delivery)  VALUES ('".$name."', '".$phone."', '".$address."','".$size."','".$toppings."','".$delivery.")";
    $done=mysql_query($query);
    echo $done;        

    $total = 0;
    $total = sizecost()  + deliverycost() + toppingcost();

    echo " $name  your {$_GET["size"]} pizza will come in 45 minutes.";
    echo "Total: $ $total";
    echo " Your Toppings are ";
    foreach($toppings as $topping) {
    echo $topping  ;
     }
    echo "Your Delivery Type:{$_GET["type"]}";
    echo "Database Updated";

    function sizecost() {
        $size = 0;
        if ($_GET['size'] == "Small"){
            $size+=5;

        }
        else if ($_GET['size'] == "Medium"){
            $size+=10;

        }
        else if ($_GET['size'] == "Large"){
             $size+=15;
        }
         return $size;


    }

   function toppingcost() {
        $toppings = $_GET['toppings'];

        foreach($toppings as $topping) {
         $topping=1;    
         $topping=$topping+1; 
     }
        return $topping;
    }

    function deliverycost() {
        $deliverycost = 0;
        if ($_GET['type'] == "delivery") {
            $deliverycost += 5;
        }
        return $deliverycost;
    }
Run Code Online (Sandbox Code Playgroud)

And*_*und 8

最后一个值在最后缺少单引号.