2
我對PHP很新,只是想學習,但似乎無法擺脫大門,所以請......不要笑:)。我試圖創建一個非常基本的表單,這將允許我從mysql獲取信息並將信息發佈到html頁面。下面是我到目前爲止有:如何將表格數據插入html頁面?
<?PHP
//connect to the server
$connect = mysql_connect("localhost","root","")
///connect to the database
mysql_select_db("test")
//query the database
$query = mysql_query("SELECT * FROM mary WHERE name = 'mary' ")
//fetch the results/convert the results into an array
WHILE($rows = mysql_fetch_array($query):
$name = $rows['name'];
$pet = $rows['pet'];
$email = $rows['email'];
echo "$name<br>$pet<br>;$email";
endwhile
?>
<html>
[name] had a little [pet]. Her fleece was white as snow. Everywhere [name] went, the [pet] was sure to follow.
</html>
我不斷收到類似如下的錯誤:
解析錯誤:在d解析錯誤:\ WAMP \ WWW \測試\模塊\ mod_php的\ mod_php的.PHP(36):的eval()「上線d碼8
OR(如果我不問PHP評價)
$pet
;$email"; endwhile ?> [name] had a little [pet]. Her fleece was white as snow. Everywhere [name] went, the [pet] was sure to follow.
我正在使用PHP模塊文件如下:
<?php
/*
* mod_html allows inclusion of HTML/JS/CSS and now PHP, in Joomla/Mambo Modules
* @copyright (c) Copyright: Fiji Web Design, www.fijiwebdesign.com.
* @author [email protected]
* @date June 17, 2008
* @package Joomla1.5
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// mod_php version
$ver = '1.0.0.Alpha1-J1.5';
// get module parameters
$php = $params->get('php');
$eval_php = $params->get('eval_php');
$discovery = $params->get('discovery');
// remove annoying <br /> tags from module parameter
$php = str_replace('<br />', '', $php);
// show that site uses mod_php
$debug = $discovery ? JRequest::getVar('debug') : false;
if ($discovery) {
echo "\r\n<!-- /mod_php version $ver (c) www.fijiwebdesign.com -->\r\n";
}
if ($debug == 'mod_php') {
echo '<div style="border:1px solid red;padding:6px;">';
echo '<div style="color:red;font-weight:bold;">Mod PHP</div>';
}
// evaluate the PHP code
if ($eval_php) {
eval("\r\n?>\r\n ".$php."\r\n<?php\r\n");
} else {
echo $php;
}
// end show site uses mod_php
if ($debug == 'mod_php') {
echo '</div>';
}
if ($discovery) {
echo "\r\n<!-- mod_php version $ver/ -->\r\n";
}
?>
誰能幫助犯harikari一個新手?謝謝!!!
所以,這是進入一個基於的Joomla,網站,或者它應該只是你的標準網頁? – Guttsy
你的'過了一會兒失蹤)($行= mysql_fetch_array($查詢):' – jackJoe
如果你不這樣做「PHP評價」你剛剛得到的文件的原始內容有沒有這樣的事,作爲一個。 PHP腳本 - 只有正好包含php代碼塊的文本文件,如果你在瀏覽器中做了一個view-source,你會看到原始的PHP + html代碼 –