SQL syntax error ?? Query & nbsp; failed: SQLSTATE [42000]: & nbsp; Syntax & nbsp; error & nbsp; or & nbsp; access & nbsp; violation: & nbsp; 1064 & nbsp; you SQL syntax error ??
Query failed: SQLSTATE [42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'frommembers WHERE id = 0' at line 1
require_once("common.inc.php");
require_once("config.php");
require_once("Member.class.php");
require_once("LogEntry.class.php");
$memberId = isset($GET_["memberId"])?(int)$_GET("memberId"):0;
if(!$memberId = Member::getMember($memberId)){
displayPageHeader("Error");
echo" Member not found.";
displayPageFooter();
exit;
}
$logEntries = LogEntry::getLogEntries($memberId);
displayPageHeader("View member: ".$member->getValueEncoded("firstName")." ".$member->getValueEncoded("lastName"));
?>
Username
getValueEncoded("username")?>
First name
getValueEncoded("firstname")?>
Last name
getValueEncoded("lastname")?>
Joined on
getValueEncoded("joinData")?>
Gender
getGenderString()?>
Favorite genre
getFavoriteGenreString()?>
Email address
getValueEncoded("emailAddress")?>
Other interests
getValueEncoded("otherInterests")?>
Access log
Web page
Number of visits
Last visit
$rowCount = 0;
foreach($logEntries as $logEntry){
$rowCount++;
?>
>
getValueEncoded("pageUrl")?>
getValueEncoded("numVisits")?>
getValueEncoded("lastAccess")?>
}
?>
Back
displayPageFooter();
?>
Share:
------ Solution --------------------
Query failed: SQLSTATE [42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'frommembers WHERE id = 0' at line 1
The basic format of the select command is
SELECT field list FROM table name
How can the SQL command parser recognize FROM and members when you stick them together?
------ Solution --------------------
Is to let you write separately, otherwise the FROM keyword cannot be identified.
------ Solution --------------------
Check whether the Member data table exists.