麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
大侠帮忙看一下,是什么错误?
悬赏分:20 - 2007年08月17日

原代码如下: Exploring Wines in a Region <?php include 'db.inc'; include 'error.inc'; // Show all wines in a region in a function displayWinesList($connection, $query, $regionName) { // Run the query on the DBMS if (!($result = @ mysql_query ($query, $connection))) showerror(); // Find out how many rows are available $rowsFound = @ mysql_num_rows($result); // If the query has results ... if ($rowsFound > 0) { // ... print out a header echo "记录: $regionName
"; // and start a
. echo "\n
\n" . "\n\t" . "\n\t" . "\n\t" ; // Fetch each of the query rows while ($row = @ mysql_fetch_array($result)) { // Print one row of results echo "\n" . "\n\t" . "\n\t" . "\n\t" . "\n"; } // end while loop body // Finish the
IDNameemail
" . $row["id"] . "" . $row["name"] . "" . $row["email"] . "
echo "\n
"; } // end if $rowsFound body // Report how many rows were found echo "$rowsFound records found matching your criteria
"; } // end of function $scriptName = "example.php"; // Has the user provided the parameter? if (empty($regionName)) { // No, the user hasn't provided a parameter ?>


Enter a region to browse : (type All to see all regions)

Home <?php } // end of if empty($regionName) body else { // Secure the user parameter $regionName $regionName = clean($regionName, 30); // Connect to the MySQL DBMS if (!($connection = @ mysql_connect($hostName, $username, $password))) die("Could not connect"); if (!mysql_select_db($databaseName, $connection)) showerror(); // Start a query ... //$query = "SELECT * FROM test t"; $query="select test.id, test.name, test.email from test " ; // ... then, if the user has specified a region, // add the regionName as an AND clause ... if ($regionName!="all") $query .= " AND test.name = \"$regionName\""; // ... and then complete the query. $query .= " ORDER BY test.name"; // run the query and show the results displayWinesList($connection, $query, $regionName); // Close the DBMS connection mysql_close($connection); } // end of else if empty($regionName) body ?> 当在text框中输入all时,查询可以显示数据,当输入想要查询的姓名时就会出现类似以下错误: Error 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 'AND test.name = "roc" ORDER BY test.name' at line 4 高手帮忙看一下,怎么解决?

提问者:hepeng   08-17 17:05
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
88 + 93 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM