thenewprogrammer
New Member
- Messages
- 45
- Reaction score
- 0
- Points
- 0
trying to grab data from table and than echo it out in profile but its not working or if anyone has better profile way they like to help me with
Code:
<?
$user = $_GET['user'];
session_start();
if(isset($_SESSION['user'])){
} else {
echo "
<script language='javascript'>
alert('Sorry, but you must login to view the Profile area!');
</script>
<script>
window.location='http://thenewprogrammer.x10hosting.com'
</script>
"; }
$dbhost = "localhost";
$dbname = "*****";
$dbuser = "*****";
$dbpass = "*****";
mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$query="SELECT * FROM login WHERE username='$username'";
$result=mysql_query($query);
$row = mysql_fetch_array ( $result );
print_r($row);
?>
<html>
<head>
User Profile
</head>
<body>
<? echo $username ?>
</body>
</html>