Jump to content

Shadowing

Members
  • Posts

    722
  • Joined

  • Last visited

Everything posted by Shadowing

  1. Ahh I missed him saying that he successfully echoed it. But idk I think he meant if he gives _post a value on the php page the php function works and not that he retrieved anything via _post
  2. I've never used ajax with out jquery. But for kicks try /li.php With adding the /
  3. Thanks for the replies guys I got this to work using jazzman's route SELECT users.id FROM users LEFT JOIN game ON users.id != game.id WHERE users.computer_player = 1 GROUP By users.id pyscho return empty query. columns for game.id is unique and users.id is unique. So no multiple associations. The game table either has that id in it or it doesnt. Even though group by works so anyways my test didnt test to make sure this part works users.id != game.id but left joining it like that should only return results if there are no matches right? I'll double check here in a bit.
  4. Hey guys I need help with a select statement I can't figure out I'm wanting to select users.id that does not match game.id where users.computer_player = 1 I tried this below which gives me 9 duplicate id's for every id selected. Can't figure out why. hoping someone can help me out. users.id and game.id are both unique index's SELECT users.id FROM users LEFT JOIN game ON users.id != game.id WHERE users.computer_player = 1 results from this query id 6876 6876 6876 6876 6876 6876 6876 6876 6876 6877 6877 6877 6877 6877 6877 6877 6877 6877 6878 6878 6878 6878 6878 6878 6878 6878 6878 6879 6879 6879
  5. places the players id on the planet to show he owns it This script doesnt get used much maybe i should just do this with two seperate queries Thought it would be kewl if it was combinable. I just started with using joins on my scripts so pretty new to it.
  6. what i really wanted to do was use a left join in a update. so im updating the row in the same query and also comparing to make sure the row im selecting isnt matching in the travel table. something like this but syntax is incorrect UPDATE planets SET planets.id = 4005 LEFT JOIN travel ON planets.address = travel.defender_planet WHERE travel.defender_planet IS NULL
  7. oh thanks alot Jessica so it selects the row that comes up Null interesting
  8. Hey guys im trying to select a row from table planets where there are no matches between planet.address and travel.defender_planet I dont think im using inner join correctly at all here i'm thinking when you want a return result it wont work when there are not two columns matching in two tables SELECT planets.address FROM planets LEFT JOIN travel ON planets.address != travel.defender_planet WHERE planets.address != travel.defender_planet LIMIT 1 My end objective is to let me select a row from planets.address where there are no rows in travel table with that address
  9. Thanks PFMaBiSmAd few minutes to late
  10. Alright i got this to work Select owner, homes, MAX(homes) AS homes from planets where owner != '' GROUP BY owner order by homes DESC
  11. that gives me this return I think its correct but its doing it backwards grabing every users lowest amount ChristainF: ya i understood you wanted me to write statement but i have no idea i couldnt even write it in english so you guys could understand what im trying to do hehe
  12. So it should end up LordDougy 30 Rumo 28 Lordcruz 25 Neimenljivi 25 Matei 23 Apofis 22 Ashrak 20 Yahweh 20
  13. nah no total In the picture i posted Notice LordDougy is holding 1st ,5th and 10th place i dont want his 5th and 10th place to be included so Matei should be in 5th instead. so once it grabs a user it no longer grabs that user again
  14. Its a list of planets players own more then one planet each planet has a level of homes on them im trying to grab the players with the highest level of homes in order with out having duplicates. so like lets say one player is holding 1st and 2nd place of the highest level of homes I dont want it to grab the 2nd place only the 1st. lol hope that makes sense.
  15. i think its working now but order by is being ignored. I guess maybe i cant say group by order by
  16. I think i got the correct return now using group by SELECT COUNT(*) FROM planets WHERE id != '' group by owner SELECT owner,$building FROM planets WHERE id != '' group by owner ORDER BY $building DESC LIMIT $offset, $rowsperpage
  17. thanks for the reponse jesirose so thats how that works hmm well what im trying to do is make it so the owner names are not duplicating
  18. Thanks for the reply ChristianF Here is my return
  19. Hey guys im having a issue with getting DISTINCT to work im pulling 2 columns using pagination so im counting first and then selecting but it still giving me duplicate owners SELECT COUNT(DISTINCT owner) FROM planets WHERE id != '' SELECT DISTINCT owner, homes FROM planets WHERE id != '' ORDER BY homes DESC LIMIT $offset, $rowsperpage
  20. oh wait a sec i know whats going on now, the way i was doing it was correct. my example was incorrect i did this statement a week ago and looked at it now and thought it was wrong but it is correct if all those columns with the math is equal to the variable $travel3 = "SELECT defender_gbx FROM travel WHERE '".($session_x)."' = CEIL((attacker_gbx + ((defender_gbx - attacker_gbx) * ((UNIX_TIMESTAMP() - sent_time) / (arrived_time - sent_time)))) / 600) AND '".($session_y)."' = CEIL((attacker_gby + ((defender_gby - attacker_gby) * ((UNIX_TIMESTAMP() - sent_time) / (arrived_time - sent_time)))) / 450) AND stance <> 1 AND stance <> 5 AND stealth_tech <= '".($_SESSION['stealth'])."'";
  21. lol oh ya haha wierd idk why i was making that more complicated then it needed to be haha Thanks ChristianF
  22. made a small example as simpliest as possible. I'm trying to do is only select the row if x is equal to $x but i have to do some math on some columns to see if its equal to little confusing hope someone knows what im trying to do $x = 2; Select id from travel where x = defender_x + defender_y "but only select it if its also equal to $x"
  23. is it possible to add a statement in this select. I only want this update to this column to happen if the column planet_tax_id is not equal to the column id cant use the WHERE clause cause i have another column updating also that isnt included in the code below so is it possible to add a switch and still use the column in the switch a = b ? a : b <<<< this type of switch forgot what its called Tarrany or something "UPDATE planets SET tax_technology = planet_tax_id <> id ? tax_technology + ceil(laboratories * $laboratories_technology * efficiency * .05) : tax_technology WHERE id <> ''";
  24. thanks for the responce jazzman I think i got it figured out apparently i need to be using a header using header('Content-Type: text/html; charset=utf-8');
  25. I had a problem come up where i have users using this wierd character when typing ? When this character is used at the end of a line it makes my script fail $return = "?"; If i echo it works but if i try to insert it into an array for ajax it returns NULL the variable in the array ends up NULL echo json_encode(array("display" => $return)); Anyone know what i need to do to filter this? i wraped htmlspecialchars around it and it didnt work EDIT: the forum doesnt allow me to type in the wierd character so it shows as a question mark instead
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.