Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
数据没有从PHP显示在MYSQL中_Php_Mysql - Fatal编程技术网

数据没有从PHP显示在MYSQL中

数据没有从PHP显示在MYSQL中,php,mysql,Php,Mysql,我试图在MYSQL中存储一些在HTML表单上收集的数据。我没有得到任何错误,但当我检查数据库时,没有添加行。 在我收集信息的页面上,去掉一些多余的数据,然后将其转移到工作类 if (!empty($_POST['work1'])){ $errors = array(); $user_id = $userID; $type = "1"; $location = substr($_POST["work1"], 37, -11); $work = new Wor

我试图在MYSQL中存储一些在HTML表单上收集的数据。我没有得到任何错误,但当我检查数据库时,没有添加行。 在我收集信息的页面上,去掉一些多余的数据,然后将其转移到工作类

if (!empty($_POST['work1'])){
    $errors = array();
    $user_id = $userID;
    $type = "1";
    $location = substr($_POST["work1"], 37, -11);
    $work = new Work ($user_id,$type,$location);

     if($work->addWork())
        {
            if($work->sql_failure)  $errors[] = lang("SQL_ERROR");
        }
     if(count($errors) == 0) {
    $successes[] = $work->success;

     }
 }
工人阶级如下

class Work
{
private $user_id;
private $type;
private $location;
public $sql_failure = false;
public $success = NULL;
public $status = false;

function __construct($user_id,$type,$location)
{
    $this->user_id = $user_id;
    $this->type = $type;
    $this->location = $location;
}
    public function addWork() {
       global $mysqli,$websiteUrl,$db_table_prefix;

            $i = 0;
            $stmt = $mysqli->prepare("INSERT INTO     ".$db_table_prefix."portfolio_info (
            user_id,
            type,
            location
            )
            VALUES (
            ?,
            ?,
            ?
            )");
        $stmt->bind_param("iis", $this->user_id, $this->type, $this->location);
        $stmt->close();
        return $i;
    }
  }

$stmt->execute();从AddWork中消失了谢谢你的第二双眼睛$stmt->execute();从AddWork中消失了谢谢你的第二双眼睛!