titan7262
Sep 6th, 2005, 10:54 PM
hi i just started PHP this morning.. i am having some error here.. can you please help me fix this and explain why it occured..
i hae this in my login.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Malboro Guestbook</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php include("dbconnect.php");?>
<form action = "addentry.php" method = "post">
<br>
Username: <input type = "text" name = "myUser">
<br><br>
Password: <input type = "text" name = "myPass">
<br><br>
<input type = "submit" name = "submit" value = "Add User">
</form>
<br><br><br>
<?php
$sd = mysql_select_db("MIS", $conn)
or die ("Could Not Select DB" . mysql_error());
$tableaccess = "select muser, mpass, mlevel from portalguard";
$sb = mysql_query($tableaccess, $conn);
while ($row = mysql_fetch_array ($sb))
{
echo("<b>username:</b> ". $row['muser']);
echo("<BR>");
echo("<b>Password: </b>". $row['mpass']);
echo("<BR>");
echo("<b>level: </b>". $row['mlevel']);
echo("<hr>");
echo("<BR>");
}
?>
<br><br><br><br>
</body>
</html>
and for my connection i have this.. (dbconnect.php)
<?php
$host = "localhost";
$user = "root";
$password = "admin";
$conn = mysql_connect($host, $user, $password)
or die ("Could Not Connect to DB");
?>
and this for adding entries..(addentry.php)
<?php include("dbconnect.php")
$luser = $_POST['myUser'];
$lpass = $_POST['myPass'];
$sd = mysql_select_db("MIS", $conn)
or die ("Could Not Select DB");
$tableinsert = "INSERT INTO portalGuard (muser, mpass, mlevel) VALUES ('".$luser."', '$".lpass."','".admin."')";
$sd = mysql_query($tableinsert, $conn);
?>
the error says:
Parse error: parse error, unexpected T_VARIABLE in D:\PHPWEB\addentry.php on line 2
i can't fix this problem.. may you guys can..
i hae this in my login.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Malboro Guestbook</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php include("dbconnect.php");?>
<form action = "addentry.php" method = "post">
<br>
Username: <input type = "text" name = "myUser">
<br><br>
Password: <input type = "text" name = "myPass">
<br><br>
<input type = "submit" name = "submit" value = "Add User">
</form>
<br><br><br>
<?php
$sd = mysql_select_db("MIS", $conn)
or die ("Could Not Select DB" . mysql_error());
$tableaccess = "select muser, mpass, mlevel from portalguard";
$sb = mysql_query($tableaccess, $conn);
while ($row = mysql_fetch_array ($sb))
{
echo("<b>username:</b> ". $row['muser']);
echo("<BR>");
echo("<b>Password: </b>". $row['mpass']);
echo("<BR>");
echo("<b>level: </b>". $row['mlevel']);
echo("<hr>");
echo("<BR>");
}
?>
<br><br><br><br>
</body>
</html>
and for my connection i have this.. (dbconnect.php)
<?php
$host = "localhost";
$user = "root";
$password = "admin";
$conn = mysql_connect($host, $user, $password)
or die ("Could Not Connect to DB");
?>
and this for adding entries..(addentry.php)
<?php include("dbconnect.php")
$luser = $_POST['myUser'];
$lpass = $_POST['myPass'];
$sd = mysql_select_db("MIS", $conn)
or die ("Could Not Select DB");
$tableinsert = "INSERT INTO portalGuard (muser, mpass, mlevel) VALUES ('".$luser."', '$".lpass."','".admin."')";
$sd = mysql_query($tableinsert, $conn);
?>
the error says:
Parse error: parse error, unexpected T_VARIABLE in D:\PHPWEB\addentry.php on line 2
i can't fix this problem.. may you guys can..