Jump to content


Photo

How to display correct gender?


  • Please log in to reply
3 replies to this topic

#1 Gregg

Gregg
  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts
  • LocationUSA

Posted 24 August 2006 - 06:26 PM

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..

<?
if($rowuser["genderid"]%2==0)
echo Female;
else
echo Male;
?>


#2 ronverdonk

ronverdonk
  • Members
  • PipPipPip
  • Advanced Member
  • 277 posts
  • LocationNetherlands

Posted 24 August 2006 - 06:34 PM

Is this what you mean?

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

Ronald  8)
RTFM is an almost extinct art form, it should be subsidized.

#3 emehrkay

emehrkay
  • Staff Alumni
  • Advanced Member
  • 1,214 posts

Posted 24 August 2006 - 06:47 PM

http://us3.php.net/m...ures.switch.php

#4 Gregg

Gregg
  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts
  • LocationUSA

Posted 24 August 2006 - 07:14 PM

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;
?>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users