07-07-2010, 03:52 PM
Looking for some more help xD.
This time, I want to display the gender of the user on the 'profile'. I have added the correct fields in the register form and the database via PHPMyAdmin.
I use the below code for the 'profile':
The dump returns this:
bool(false)
But the $gender displays nothing.
Can anyone tell me how to fix this?
Thanks in advance! :)
This time, I want to display the gender of the user on the 'profile'. I have added the correct fields in the register form and the database via PHPMyAdmin.
I use the below code for the 'profile':
PHP Code:
<?php
include ('functions.php');
if (!loggedin())
{
header("location:login.php");
exit();
}
?>
<html>
<?php
//connect to database
mysql_connect("localhost","cameron_cameron","MYPASSGOESHERE") or die();
mysql_select_db("cameron_login") or die();
$welcome = $_SESSION['username'];
$query = mysql_query("SELECT * FROM users WHERE gender='$gender'");
$gender = mysql_fetch_array($query);
var_dump($gender);
echo "Welcome, ".$welcome."! - <a href='logout.php'>Logout</a>";
echo "You are ".$gender."!";
?>
The dump returns this:
bool(false)
But the $gender displays nothing.
Can anyone tell me how to fix this?
Thanks in advance! :)