0
我正在使用wamp服務器。我使用Dreamweaver創建php文件。 這裏是我的代碼:將php連接到sql server
-untitled.php
<?php
include 'E:\wamp\www\PHP\connection.php';
$query ="SELECT * FROM students";
$result = mysql_query($query);
while($students = mysql_fetch_array($result)) {
echo "<h3>".$students['LNAME'] ."</H3>";
}
?>
<h1>Create A user</h1>
<form action="create.php" method="post">
<input type="text" name="LName" value="" />
<input type="text" name="FName" value="" />
<input type="text" name="MName" value="" />
<input type="text" name="GradeOrYear" value="" />
<input type="text" name="Address" value="" />
<br/>
<input type="submit" name="Submit" value="" />
</form>
-Connection.php
<?php
$dbhost = 'localhost';
$dbuser- 'root';
$dbpass= '';
$dbname = 'koro';
$conn =mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db);
?>
但我得到這個錯誤: http://www.mypicx.com/01172010/rs/
請,我怎麼能解決這個問題?
+1 Ignacio - 你得到了$ dbuser-'root'而不是$ dbuser ='root' – 2010-01-17 08:03:46