lundi 13 août 2018

Error: You have an error in your SQL syntax; check the MariaDB server version for the right syntax to use near ''student'' at line 1 [duplicate]

This question already has an answer here:

class student extends DatabaseConfiguation
{
    public function validateStudent($std_id,$std_name,$std_address,$std_class_num,$std_grade)
    {
        if($std_id=="" || $std_name=="" || $std_address=="" || $std_class_num=="" || $std_grade=="")
        {
            return 0;
        }
        return 1;
    }
    public function addStudent($std_id,$std_name,$std_address,$std_class_num,$std_grade)
    {
        $result= mysqli_query($this->conn,"INSERT into 'student'(std_id,std_name,std_class_num,std_address,std_grade)values('$std_id','$std_name','$std_class_num','$std_address','$std_grade')");
        if($result)
        {
            echo "<div class='alert alert-success'>Student Added to system</div>";
        }
        else{
            echo "<div class='alert alert-danger'>Error </div>";
        }


    }


    public function getAllStudent()
    {
        $query= mysqli_query($this->conn,"select * from 'student'");

        while ($row = mysqli_fetch_array($query))
        {
            echo "<tr>";
            echo "<td>".$row['id']."</td>";
            echo "<td>".$row['std_id']."</td>";
            echo "<td>".$row['std_name']."</td>";
            echo "<td>".$row['std_class_num']."</td>";
            echo "<td>".$row['std_address']."</td>";
            echo "<td>".$row['std_grade']."</td>";
            echo "<td>".$row['date_of_submission']."</td></tr>";
        }
        if (!$query) {
            printf("Error: %s\n", mysqli_error($this->conn));
            exit();
        }

    }




Aucun commentaire:

Enregistrer un commentaire