Hi have 2 queries, hope somebody can help.
the first is how do i edit this function so that it works with my phpmyadmin database when it has no username or password? The database is called duffers. Everytime i edit it i get errors. (sorry im just learning php)
function setupdb($dbuser,$pw,$dbase)
{
$this->dbuser=$dbuser;
$this->pw=$pw;
$this->dbase=$dbase;
$this->db = mysql_connect('localhost',$dbuser,$pw);
}
and the second query is, i have my website set up with sessions, so was wandering how do i display the persons information once he has logged in. I.e i need the query to recognise the username from of the the logged in user and only display his information, here was my attempt.
<?php
//session start and get variable
session_start();
$username = $_SESSION['username'];
//connect to database
$connect = mysql_connect("localhost","root","") or die ("sorry couldn't connect");
mysql_select_db("duffers") or die("couldnt connect");
$get = mysql_query("SELECT * FROM users WHERE username='$username'");
print username ='username', name = 'name', Email = 'email';
<a href='logout.php'>Logout</a>";
}
else
die("you must be logged in");
?>
any help would be greatly appreciated!!
thanks again