我已经盯着这个错误看了一个多小时了,我一辈子都看不出有什么问题。
这是我的错误:
解析错误:语法错误,第 42 行 C:\web\account.php 中的意外 '('
这是我在 html 中的第一个 php 标记之后的代码(Line42 以“$searchstring”开头)。
<?php
include_once 'header.php';
include_once 'functions.php';
require_once 'login_users.php';
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!$db_server) die("Unable to connect to database:" . mysql_error());
mysql_select_db($db_database)
or die("Unable to find database:" . mysql_error());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Weapon Build Creator</title>
<link href="styles/main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.auto-style1 {
margin-top: 0px;
}
</style>
</head>
<body style="background-image: url('images/bg.jpg')">
<div id="form" style="left: 50%">
<div class="newsdiv">
<br />
<p class="title">MY BUILDS</p>
<?php //search result table
$searchstring = "SELECT buildname,weapon,category,id,author,buildname FROM weapons WHERE author="($_SESSION['username'])" "; // Line 42
$result = mysql_query($searchstring);
if (!$result) die ("Database access failed: " . mysql_error());
$rows = mysql_num_rows($result);
.... More code down here
让我知道你是否能看到它!
万分感谢!