seany123 Posted June 27, 2009 Share Posted June 27, 2009 basically i have a table in my database called points_market... inside points market i have different values: market_id, Qty, Cost, Total_cost, Seller_id. all i want to do is make a if statement saying: If ($player->id is equal seller_id in any rows){ thats what im trying to do. Quote Link to comment Share on other sites More sharing options...
corbin Posted June 27, 2009 Share Posted June 27, 2009 SELECT 1 FROM points_market WHERE seller_id = $player->id Look into WHERE clauses of SELECT statements. Quote Link to comment Share on other sites More sharing options...
seany123 Posted June 28, 2009 Author Share Posted June 28, 2009 i was kind of looking for something more like this... $query = $db->execute("select * from `points_market`"); $pm = $query->fetchrow(); if($player->id == $pm['seller_id']){ header('Location: points_market.php'); } but this isnt working. Quote Link to comment Share on other sites More sharing options...
JJ2K Posted June 28, 2009 Share Posted June 28, 2009 What type of db are you using? I think you need to loop through them but i'm only familiar with mysql, maybe something like $query = $db->execute("select * from `points_market`"); $pm = $query->fetchrow(); while($pm = $query->fetchrow()){ if($player->id == $pm['seller_id']){ header('Location: points_market.php'); } } cause at the moment aren't you just retrieving one row don't you need to go through all of them to match a player id to a seller id. Also fetchrow might have to be fetcharray or something again im not familiar with what db you are using Quote Link to comment Share on other sites More sharing options...
seany123 Posted June 28, 2009 Author Share Posted June 28, 2009 yeah i finally worked it out... what ypou wrote is pretty much what i did also.. thanks for the help. 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.