hye guys im new here. how do i want to display data from database to web page based on login ?example i already key in john as username and password as blahblahblah . so after login i want to go another page (lala.php).
at lala php , i want it appear as "welcome ___ as __ " . the _ means data from database. means welcome john as admin . john = username from database and admin = userrole from database. i already try coding while(mysql_fetch_array) but it appear 2 times welcome because i enter 2 admin data in database(loop). how to display data from database based on which username i logged in as admin ?
if (isset($_POST['userpass']))
include("config1.php");
$username = $_POST['username'];
$userpass = $_POST['userpass'];
$query = "select * from login where username = '$username' and userpass = '$userpass'";
$result = mysql_query($query);
while ($try = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo $row['username'] . " " . $row['userrole'];
echo "<br>";
}
}
mysql_close();
at webpage it appear " Warning: mysql_close(): no MySQL-Link resource supplied in C:xampphtdocsadminmain.php on line 27 " if i remove mysql_close(); there are no data from database shows
?>