【发布时间】:2015-11-13 13:08:45
【问题描述】:
我不知道我哪里出错了。我不断收到以下错误:
解析错误:语法错误,意外的“;” (T_Encapsed_AND_WHITESPACE) 在 C:\xampp\htdocs...
这一行似乎是错误所在的位置。
$query="SELECT * FROM `memberinfo` WHERE `memberid` = '".$mymemberid."'"' ;
完整代码:
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="memberaccess"; // Database name
$tbl_name="memberin"; // Table name
//Declare $mymemberid as the data is submitted in the form under the "memberid" field
$mymemberid = ($_POST['memberid']);
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
//select the row in the table that matches the passed variable from the form submission
$query="SELECT * FROM `memberinfo` WHERE `memberid` = '".$mymemberid."'"' ;
$result=mysql_query($query);
if (!$result) {
die(mysql_error());
}
// assign mySQL values from table to php variables
$balance=mysql_result($result,1,"balance");
$fname=mysql_result($result,1,"FirstName");
$lname=mysql_result($result,1,"LastName");
$address=mysql_result($result,1,"address");
$city=mysql_result($result,1,"city");
$email=mysql_result($result,1,"email");
//close the mySQL connection
mysql_close();
?>
【问题讨论】:
-
默认格式向您显示提示!从查询变量中删除多余的 '
标签: php parsing whitespace