This is old code that I am reworking.
The DB query seems to be working fine but there is a problem presenting it. The <th> shows up just fine but the rest of the form does not and I don't seem to be able to output any of the query array in any way though I know they are there and have seen them using a foreach loop...
<?php
$username=$_POST['username'];
$password=$_POST['password'];
$link = mysql_connect("", "", ""); if (!$link) {
die('Not connected : ' . mysql_error());
}
$db_selected = mysql_select_db('database', $link);
if (!$db_selected) {
die ('Can\'t use database : ' . mysql_error());
}
$query = sprintf("select description, keywords, password, username FROM sites where username='%s' AND password='%s'",
mysql_real_escape_string($username),
mysql_real_escape_string($password));
$result = mysql_query($query)or die(mysql_error());
$num = mysql_num_rows($result);
$row = mysql_fetch_array($result);
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="basic.css">
</head>
<body>
<?
echo"<p><table border='0' align='center'>";
echo"<tr bgcolor='#FFFFCC'><th>Description</th><th>Keywords</th><th>Password</th>";
while ($row = mysql_fetch_array($result)) {
$n2 = $row["description"];
$n3 = $row["keywords"];
$n4 = $row["password"];
$n5 = $row["username"];
echo "<tr bgcolor='#99CCFF'>
<form action='change_info2.php' method='POST' onSubmit=\"return confirm('Edit User?');\">
<input type='Hidden' value='$n5' name='username'>
<input type='Hidden' value='$n4' name='password'>";
echo "<td align='left' valign='bottom'><input type='text' 'maxlength=100' value='$n2' name='description' size='12'></td>
<td align='left' valign='bottom'><input type='text' maxlength='100' name='keywords' value='$n3' size='12'></td>
<td align='left' valign='bottom'><input type='text' maxlength='100' value='$n4' name='password' size=''></td>
<td align='center' valign='middle'><input type='submit' value='Update'></td>
</form>
</tr>";
$x=$x+1;
}
echo"</table></p>";
// free resources and close connection
mysql_free_result($result);
MYSQL_CLOSE();
?>