Guys,
I need a code to ask database if the data is MALE or FEMALE than display a picture..
I know little about PHP !!
The database has USERINFO table than a row with MALE or FEMALE written.
Please help..
Guys,
I need a code to ask database if the data is MALE or FEMALE than display a picture..
I know little about PHP !!
The database has USERINFO table than a row with MALE or FEMALE written.
Please help..
It may depends how you want to use it.
Are you listing a list of members or one single member on the page?
List of members
//connect DB
$query = "SELECT gender FROM USERINFO";
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
$gender = $row['gender'];
}
//close DB
With that you can get the $gender of the person and by using some comparision, like strcasecmp(), you can then choose what image to display with a IF-ELSE statement.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.