Jump to content

Archived

This topic is now archived and is closed to further replies.

Gregg

How to display correct gender?

Recommended Posts

Ok, let me first say thanks to "wildteen88" for all the help last time lol.
My data base is set up to hold 6 diffrent genders.
0=None Selected
1=Male
2=Female
3=Couple
4=Group
5=Coulpe FF
6=Couple MM

But when it gets the vars it only displays "Male-Female"?? in the search.
But in the profile it displays it corectly.
Here is the php iuse to pull the info, is there a safe way to echo all but select only one..

[b][color=red]<?[/color][/b]
[color=green]if[/color]($rowuser["[color=red]genderid[/color]"][color=blue]%[/color][color=red]2[/color][color=blue]==[/color][color=red]0[/color])
[color=blue]echo[/color] Female;
[color=green]else[/color]
[color=blue]echo [/color]Male;
[color=red][b]?>[/b][/color]

Share this post


Link to post
Share on other sites
Is this what you mean?

[code]<?php
$a = array ('None Selected', 'Male', 'Female', 'Couple', 'Group', 'Coulpe FF', 'Couple MM');
$i = $rowuser['genderid'];
echo $a[$i];
?>[/code]

Ronald  8)

Share this post


Link to post
Share on other sites
it worken but messed upthe results
??
Do i need to change this code to?
<?
include("connect.php");

$sql="select * from users where loggedin='Y'";
$res=mysql_query($sql,$db);
$tot=mysql_num_rows($res);

if(!$argv[1])
{
$pg = 1;
}
else
{
$pg = $argv[1];
}
if(!$pg)
{
$pg = 1;
}
/********************************************************************
Get how many products  are to be displayed according to the  category
********************************************************************/
$total=$tot;
$StartRow =  $PRODUCTSPERPAGE * ($pg-1);

$totalpages = (int) ($total / $PRODUCTSPERPAGE);
if(($total % $PRODUCTSPERPAGE)!=0)
$totalpages++;

$sql .= " LIMIT $StartRow,$PRODUCTSPERPAGE";
$resuser=mysql_query($sql,$db);
$totalrows = mysql_affected_rows();
//echo $sql;
?>

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.