Jump to content

problem in Array


iammudassir

Recommended Posts

i have "perosn" table in database "geotex" with 3 fields dept name and agedate in table like this dept name agemale abc 33male xyz 2female 123 25 i create a table like thisperson.php field1 [dept] field2[name] field3[age]field1 [dept] field2[name] field3[age]field1 [dept] field2[name] field3[age]field1 [dept] field2[name] field3[age] and i have a button with name of "select" now i want to run a sql query select * from person where dept = maleand want to disply result like male in field1 abc in field2 33 in field 3male in field1 xyz in field2 2 in field 3 when i run php code with isset = post[select]then run above query and problem starts from here i use while ($result = mysql_fetch_array($run)) {echo $name = $result ['name'];} // this echo shows both abc and xyz but i wanna show abc name using array position } some body says use foreach but i dont have idea how to use foreach

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...