473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Make an IF statment on table text?

117 100+
Ok, what i want to do is make it if the users gender is Female, it will echo the Female.png and if its Male, echo the Male.png is this possible?

The table gender dont have any values like M, 1 just (Male, Female, Hidden)
Can this be done easily?
Aug 26 '07 #1
3 1044
gregerly
192 Expert 100+
Ok, what i want to do is make it if the users gender is Female, it will echo the Female.png and if its Male, echo the Male.png is this possible?

The table gender dont have any values like M, 1 just (Male, Female, Hidden)
Can this be done easily?
Ok, here's what I understand about your post:

You are collecting user data somehow, registration form, login, etc...and you have access to their gender. The gender is stored in the Gender table.

If the above is accurate then you would need to query for gender, and then load an appropriate img based on gender. Here is how I would do this:

[PHP]<?php

//query for the gender, your sql will vary based on table fields
$sql="SELECT gender_tbl.gender FROM gender_tbl WHERE gender_tbl.userid = $userid";
$result=@mysql_query($sql);
list($gender)=@mysql_fetch_row($result);

//create a variable to load proper variable
$loadImg=($gender=="male")?"male.png":"female.png" ;

?>[/PHP]
Then when you need to load the the img

[PHP]<img src='./path/to/img/<?=$loadImg; ?>' alt='Your alt text' />[/PHP]
Aug 26 '07 #2
Breana
117 100+
Thanx for the reply, i allready solved it im bad i wont post help in tell i am stuck lol i just made it so when they signed up and selected there gender it saved the image code instead of the text lol..

But you can maybe awnser this for me i cant do it i have been trying all day..
How can i limit the number of results to 10 and have a Next >> button appear or << Back on the bottom if there is more than 10 users?
Aug 26 '07 #3
Atli
5,058 Expert 4TB
Check out this post.

And please try to post new questions in new threads.
Aug 27 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: LRW | last post by:
I did a Web search, and a deja.com search on this...and I'm finding how to make checkboxes act like radiobuttons, and other interesting behaviors, but nothing that quite answers my question. If...
8
by: abbylee26 | last post by:
User enters account number if another account number is needed User clicks add account which creates another row When validating when they hit submit I want to check to make sure they tell us...
1
by: Joe Saliba | last post by:
Hi, would like to know how to write a crosstable select statment in sql server2000 where having: - ItemNumber, ItemDescription, ItemColor, ItemSize as rows - Stores as columns - Qty * Netttc...
2
by: Dyslexic Fingars | last post by:
Warning I'm new to anything other than basic SQL so this 'might' seem like a daft question. My problem is - I've have two tables one hold's photo details and is called 'PhotoTable' it is linked...
1
by: Anton Nikiforov | last post by:
Dear All, could you please help me with writing select statment for the following: I have two tables dictionary_text label| Text -----+------------------------ 23 | General 24 | Internet...
2
by: Denis Correard | last post by:
I have an application that create an insert statment on the fly (it would be to complex to create stored procedures for all senarios) like: insert into Table (field1, field2,field3 ,field4 ) VALUES...
5
by: vsteshenko | last post by:
Hello, This is my second post to the any usernet group and the first one was posted to the wrong one. I am currently working on creating an order form for sales associates at my work to be used...
1
by: zeebiggie | last post by:
Good morning I have a form with the controls in the insert statment below. table1 has an Auto increment primary key hence is omitted in the insert statment and form. Am getting the error It didnt...
4
by: Breana | last post by:
Ok, i want to make a sql statment select from a table, random quotes and display a random one each time the page is loaded! I got it to connect, but it keeps selecting all of them... <?php ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.