There are two fields in table "users": username, webaddress
I have limited knowledge of PHP but have put this script together. However, when entering the four digit number I receive the following in the address bar:
http://www.website.com/Array
Can someone review this and help me figure out how to make it work?
Here is the script:
Code: Select all
<?php
// Connects to your Database
mysql_connect("localhost", "db_username", "db_password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$result = mysql_query("SELECT * FROM users
WHERE username='$username'");
{
while($row = mysql_fetch_array($result))
$row['webaddress']
{
header("Location:$row")
}
?>
<html>
<head>
<title>PHP Test Page</title>
</head>
<body>
<center><b>
<form action="testing.php" method="post">
<table border="0">
<tr><td colspan=2><h1>Login</h1></td></tr>
<tr><td>Username:</td><td>
<input type="text" name="username" maxlength="40">
</td></tr>
<tr><td colspan="2" align="right">
<input type="submit" name="submit" value="Login">
</td></tr>
</table>
</form>
</b></center>
</body>
</html>
<?php
}
?>