致命错误:无法在第16行中重新声明insertTodo

时间:2019-02-03 04:44:15

标签: php

<?php

try{
$conn = new PDO('mysql:host=127.0.0.1;dbname=todo', 'root', '');
} catch( PDOException $e){
    echo 'khob jotil';
}

function insertTodo($data){
    global $conn;
     $sql = "INSERT INTO `task`(`name`) VALUES (:title)";
      $stmt = $conn->prepare($sql);
     return $stmt->execute(array(
        ':title' => $data
    ));
}

function readData($table = 'task', $done = 0){
    global $conn;
    $sql = "SELECT * FROM $table";

    $res = $conn->query($sql);
    return $res->fetchAll();
}


?>

0 个答案:

没有答案