Connecting php to sql server
I'm using wamp server. And I use dreamweaver to create php f开发者_开发技巧iles. Here is my code:
-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);
?>
But I get this error: http://www.mypicx.com/01172010/rs/
Please, how can I fix this error?
Did you mean $dbuser = 'root';
instead perhaps?
精彩评论