否则不使用PHP

时间:2016-07-16 17:50:36

标签: php

我的代码有问题

$save = mysql_real_escape_string($_POST['save']);
$query1 = "SELECT * from users WHERE user_id=".$_SESSION['user'];
$result = mysql_query($query1);

while($row = mysql_fetch_array($result)) {
    // Get money from column
    $money = $row['money'];

    if($money >= $save)

        $query1 = "UPDATE users SET savings = savings + $save, money = money - $save WHERE user_id=".$_SESSION['user'];

        $update1 = mysqli_query($conn,$query1); // call 1st query
        echo 'Money transferred successfully!!!';
    } else  {
        echo 'U NO MONEY IN CHECKING!!!!';
    }
?>

else语句无效,我收到此错误:

  

解析错误:语法错误,意外的“其他”(T_ELSE)   第44行的C:\ wamp \ www \ bank.php

2 个答案:

答案 0 :(得分:0)

请注意,在if语句之后,你没有打开过大括号。

改变这个:

free

要:

if($money >= $save)

答案 1 :(得分:0)

你错过了import {composeWithTracker} from 'react-komposer'; import ClassroomDashboard from '/imports/components/classroomDashboard/ClassroomDashboard.jsx'; class ClassroomDashboardContainer extends React.Component { onSubmitHandle(e) { // check form data and submit to DB } render() { return( <ClassroomDashboard {...this.props} onSubmit={this.onSubmitHandle.bind(this)} /> ) } } function composerFunction(props, onData) { const handle = Meteor.subscribe('classroom'); if (handle.ready()) { const classroom = Classrooms.findOne(props.params.id); onData(null, {classroom}); }; }; export default composeWithTracker(composerFunction)(ClassroomDashboardContainer); 声明中的开头大括号:

if