Sorry forgot the ';' This is the code you should use
PHP Code:
function displayUsersData($username, $table) {
$con = connect(); // <--- THIS LINE IS JUST FOR THE CODE, REPLACE IT WITH YOUR DB CONNECTION
$query = "SELECT * FROM " .$table. " WHERE username='$username'"; //SELECTS ALL INFO FROM THE DB WHERE THE USERNAME IS THE USERS USERNAME, thats weird to say
$result = mysql_query($query, $con) or die(mysql_error()); //THE QUERY
while($data = mysql_fetch_array($result)){
echo $data['email']; //This will echo the row in the database called email, replace this with whatever row you want and you can add more lines, see below
echo $data['id']; //And more
echo $data['something']; //And so on...
}
}
//TO CALL THE FUNCTION
displayUsersData($username, $table_name); //Replace with your values