PDA

View Full Version : mysql/php question



jetalomar
April 5th, 2002, 14:41
i want to call a string from a table using php/mysql
here is the code to call them. but i have a column name pos and there i have this stats" P, SS, 2B, 3B, C, RF, CF, LF and DH"

i want it to display all the position except the P how can i do it from this code?
$result = mysql_query ("SELECT * FROM players WHERE team='$team");

cheatpark
April 5th, 2002, 14:46
while($row = mysql_fetch_array($result)){

You need to add the above code.

echo "$row["SS"];

For each row do that.

And at the end add a }.

jetalomar
April 5th, 2002, 14:54
that's not my question. my question is that i have a colum name Pos on it i have this type of data SS, 2B, RF , P etc.

i want all of them except the P,
is like if i want to disply only the P i will do this
$result = mysql_query ("SELECT * FROM players WHERE team='$team' and pos='P'"); but i don't want to display the P that's my problem

cheatpark
April 5th, 2002, 14:58
If you echo all of them apart from the P then the P shouldn't appear.

jetalomar
April 5th, 2002, 15:03
if i echo $row[SS] nothing will show because i don't have any field name SS but under pos i have the stats SS
if i do echo "$row[pos]"; it will print all the position P, SS, 3b ETC. that's what i want to do to display all of them except the P

jetalomar
April 5th, 2002, 15:12
i can do it from this way,


$result = mysql_query ("SELECT * FROM players WHERE team='$team' and ((pos='1B') or (pos='2B') or (pos='3B')or (pos='SS')or (pos='1B')) "); but it's too long i'm sure they is another way to do them

jetalomar
April 5th, 2002, 22:58
nobody seens to care about helping others.

jetalomar
April 8th, 2002, 21:00
i still need help on this script.

Graeme
April 10th, 2002, 10:21
have you tried

WHERE pos!='P'

jetalomar
April 10th, 2002, 12:24
no and thanks. I will try it now

jetalomar
April 10th, 2002, 12:27
yeah it worked, that was my question thanks again