MySQL Database call help
07-07-2010, 03:52 PM,
#1
MySQL Database call help
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':
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! :)
Hey.
Reply


Messages In This Thread
MySQL Database call help - by Cameron - 07-07-2010, 03:52 PM
RE: MySQL Database call help - by RichardGv - 07-07-2010, 11:17 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  MySql backup? Mone 1 1,272 06-01-2011, 02:29 AM
Last Post: capp

Forum Jump: