Gregg Posted August 24, 2006 Share Posted August 24, 2006 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 Selected1=Male2=Female3=Couple4=Group5=Coulpe FF6=Couple MMBut 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] Quote Link to comment Share on other sites More sharing options...
ronverdonk Posted August 24, 2006 Share Posted August 24, 2006 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) Quote Link to comment Share on other sites More sharing options...
emehrkay Posted August 24, 2006 Share Posted August 24, 2006 http://us3.php.net/manual/en/control-structures.switch.php Quote Link to comment Share on other sites More sharing options...
Gregg Posted August 24, 2006 Author Share Posted August 24, 2006 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;?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.