显示一行代码以及网页

时间:2014-03-12 18:15:36

标签: php

<?php
session_start();
include_once "incfiles/connectdb.php";
include_once "incfiles/func.php";
$page="gamepoints.php";
logincheck();
$username=$_SESSION['username'];
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM accounts WHERE username='$username'"));

if ($_GET['item']){

$item=strip_tags($_GET['item']); 

if ($item == "LHP"){ $cost="50"; $amount="10000"; }
elseif ($item == "FMJ"){ $cost="70"; $amount="15000"; }
elseif ($item == "rankpoints"){ $cost="150"; $amount="10000"; }
elseif ($item == "awp"){ $cost="300"; $amount="1"; }
elseif ($item == "credits"){ $cost="50"; $amount="10"; }
elseif ($item == "money"){ $cost="300"; $amount="5000000"; }

从if($ item ==“LHP”)到最后是我的网页上显示的内容以及我似乎无法弄清楚为什么

1 个答案:

答案 0 :(得分:0)

不确定这是否是您的所有代码 - 如果是,看起来您可能错过了上一个}

<?php
    session_start();
    include_once "incfiles/connectdb.php";
    include_once "incfiles/func.php";

    $page="gamepoints.php";

    logincheck();

    $username=$_SESSION['username'];
    $fetch=mysql_fetch_object(mysql_query("SELECT * FROM accounts WHERE username='$username'"));

    if ($_GET['item']){
        $item=strip_tags($_GET['item']); 

        if ($item == "LHP"){ $cost="50"; $amount="10000"; }
        elseif ($item == "FMJ"){ $cost="70"; $amount="15000"; }
        elseif ($item == "rankpoints"){ $cost="150"; $amount="10000"; }
        elseif ($item == "awp"){ $cost="300"; $amount="1"; }
        elseif ($item == "credits"){ $cost="50"; $amount="10"; }
        elseif ($item == "money"){ $cost="300"; $amount="5000000"; }
    }