Php 尝试在用户注册我的网站后将其重定向到该配置文件
我正在尝试编写一个脚本,在用户注册站点iv后,将用户的个人资料发送到那里。我得到了一个填充,mysqli_查询语法有问题。我一直收到错误PHP解析错误:语法错误,意外的“{”有人可以帮我解决这个问题吗Php 尝试在用户注册我的网站后将其重定向到该配置文件,php,session,mysqli,Php,Session,Mysqli,我正在尝试编写一个脚本,在用户注册站点iv后,将用户的个人资料发送到那里。我得到了一个填充,mysqli_查询语法有问题。我一直收到错误PHP解析错误:语法错误,意外的“{”有人可以帮我解决这个问题吗 <?php // set database connection require("dbconfig.php"); // lets get our posts // $email = $_POST['email']; $pass = $_POST['password'];
<?php
// set database connection
require("dbconfig.php");
// lets get our posts //
$email = $_POST['email'];
$pass = $_POST['password'];
$bn = $_POST['bandname'];
$state = $_POST['state'];
$genre = $_POST['genre'];
$description = $_POST['description'];
$image = $_FILES['image'];
/// valid image types ///
$image_type = array("image/jpg","image/jpeg","image/bmp","image/gif","image/png");
/// folder that will hold the image
$imagepath = "images/";
$imagepath .= $image["name"];
// move the file from the tmp folder to the image folder
if (move_uploaded_file($image['tmp_name'], $imagepath)){
$foo = `mogrify -quality 92 -scale 500x $imagepath`;
}
// insert data into mysql
if (!mysqli_query($ms,"insert into dbusers (email, password, bandname, state, genre, description ,image)
values ('$email','$pass','$bn ','$state','$genre','$description','".$image['name'] . "')" ){
}else {
$id=mysqli_insert_id($sql);// Get the associated ID number
// Set up a login session
session_start();
$_SESSION ['id' ] = $id;
$_SESSION ['bandname' ] = $bandname;
$_SESSION ['password' ] = $password;
header("Location:ympprofile.php?listid=$id");
}
?>
您缺少一个右括号
if (!mysqli_query($ms,"insert into dbusers (email, password, bandname, state, genre, description ,image)
values ('$email','$pass','$bn ','$state','$genre','$description','".$image['name'] . "')" )
)<------ you were missing this
您错过了if!mysqli_query…行的结尾。这是我第一次看到的东西-可能还有其他东西。请仔细阅读-现在是开始学习使用mysqli的prepare/bind_param/execute来保护您当前易受SQL注入攻击的代码的时候了。