本文介绍了我该怎么做才能解决此错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! hi 我有这个错误,我真的不知道如何解决它。 这是错误 解析错误:语法错误,意外' mysqli_error'(T_STRING) C:\ wamp64 \过网站上的#luana_itec244 \\\ [@ b 这是错误的来源 我尝试过: < pre > <? php if(isset( $ _POST [' submit'])) { // 从表单中捕获变量并存储在php变量中 $ title = $ _ POST [' title']; $ firstname = $ _ POST [' firstname']; $ lastname = $ _ POST [' lastname']; $ address = $ _ POST [' address']; $ txtemail = $ _ POST [' txtemail']; $ gender = $ _ POST [' gender']; $ userName = $ _ POST [' userName']; $ pword = $ _ POST [' pword']; // 连接服务器 $ db_host = localhost; $ db_username = root; $ db_password = ; $ con = mysqli_connect($ db_host,$ db_username,$ db_password)或 die(mysqli_connect_error) ()); // 选择要查询的数据库 mysqli_select_db($ con,' food')或 die(mysqli_error($ con)); $ sql = SELECT * FROM member WHERE userName ='$ userName'; $ result = mysqli_query($ con,$ sql)或 die( 错误: mysqli_error()); $ rowcount = mysqli_num_rows($ result); if($ rowcount> = 1) { echo < script type = \text / javascript \; alert('用户名已存在'); 窗口。 location = \register.html \; < / script>; } 其他 { // 将数据插入表中 $ sql = INSERT INTO成员 VALUES('$ title','$ firstname','$ lastname','$ address','$ txtemail' ,'$ gender','$ userName',MD5('$ pword')); if(mysqli_query($ con,$ sql)) { mysqli_close($ con); header( location:welcome.php); } else { echo 插入数据库时​​出错 .mysqli_error($ con); } } } ?> 解决方案 _POST [' submit'])) { // 从表单中捕获变量并存储在php变量中 title = _POST [' title']; hi i have this error and I really dont know how to go about fix it.this is the errorParse error: syntax error, unexpected 'mysqli_error' (T_STRING) in C:\wamp64\www\luana_itec244\php\register.php on line 2this is where the error is coming fromWhat I have tried:<pre><?phpif(isset($_POST['submit'])){//capture the variable from the form and store in php variables$title=$_POST['title'];$firstname=$_POST['firstname'];$lastname=$_POST['lastname'];$address=$_POST['address'];$txtemail=$_POST['txtemail'];$gender=$_POST['gender'];$userName=$_POST['userName'];$pword=$_POST['pword'];//connecting to the server$db_host="localhost";$db_username="root";$db_password="";$con = mysqli_connect($db_host,$db_username,$db_password) or die (mysqli_connect_error());//select the database you want to querymysqli_select_db($con, 'food') or die (mysqli_error($con));$sql = "SELECT * FROM member WHERE userName = '$userName'";$result=mysqli_query($con,$sql) or die("error:" mysqli_error());$rowcount=mysqli_num_rows($result);if($rowcount >= 1){echo "<script type=\"text/javascript\";alert('username already exist');window.location=\"register.html\";</script>";}else{//insert data into table$sql = "INSERT INTO memberVALUES('$title', '$firstname', '$lastname', '$address', '$txtemail', '$gender', '$userName', MD5('$pword'))";if(mysqli_query($con, $sql)){mysqli_close($con);header("location:welcome.php");}else{echo "Error inserting into database".mysqli_error($con);}}}?> 解决方案 _POST['submit'])){//capture the variable from the form and store in php variablestitle=_POST['title']; 这篇关于我该怎么做才能解决此错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-22 15:03
查看更多