数据没有从PHP显示在MYSQL中
我试图在MYSQL中存储一些在HTML表单上收集的数据。我没有得到任何错误,但当我检查数据库时,没有添加行。 在我收集信息的页面上,去掉一些多余的数据,然后将其转移到工作类数据没有从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
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中消失了谢谢你的第二双眼睛!