Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8155679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:44:12+00:00 2026-06-06T16:44:12+00:00

i have a question in regards to php calculations. i am restructuring a text

  • 0

i have a question in regards to php calculations.
i am restructuring a text based game.
the game has two “native players” right now. they get inserted periodically by a cron file.
the insert is :

//player 1 Login id = 54

mysql_query("INSERT INTO {$game}_ships (ship_name,login_name,shipclass,class_name,class_name_abbr,fighters,max_fighters,max_shields,cargo_bays,mine_rate_metal,mine_rate_fuel,config,size,upgrades,move_turn_cost,point_value,location,login_id
    ) values(   'Three 7','A','8','name','WM','4773','4773','8353','2003','5','45','bs:dt:ot','6','99','19','10',FLOOR(RAND() * 298 + 2),'54')");

player two has the same insert, only the player id is different. lets say 44.

they get inserted in random locations FLOOR(RAND() * 298 + 2) which vary from 2 to 300.

i want to create an AI in the game by selecting ships from these two players that are in the same system, comparing the fighter counts and deleting from the database the weakest.

So far i have:

mysql_query("SELECT * FROM `{$game}_ships` WHERE `login_id` = 54 AND 54 AND `location` = 234");

but im having some problems as to the rest.

Any comments or help would be greatly appreciated.

PS: i selected location = 234″ arbitrarily.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:44:13+00:00Added an answer on June 6, 2026 at 4:44 pm

    This query will give you a list of locations where both players 54 and 44 have ships:

    SELECT distinct p1s.location
    FROM `{$game}_ships` p1s JOIN `{$game}_ships` p2s ON p1s.location=p2s.location
    WHERE p1s.login_id=54 AND p2s.login_id=44;
    

    And this query will delete the weakest ship of player 54 or 44 in location 234:

    DELETE from `{$game}_ships`
    WHERE login_id IN (54, 44) AND location=234
    ORDER BY fighters LIMIT 1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a question in regards to php and css layers. i have the
First of all, this question is in regards to PHP and MySQL I have
I have got a question with regards to upgrading asp.net mvc applications from v1
I have a general question with regards to immutable collections. I will use Java
I have just asked this question an hour ago but with regards to IE8
I have two questions in regards to the PyDev (Python editor for Eclipse) and
I have a question regarding database connection in PHP and MySQL. I wonder if
I'm pretty new to php but i'm learning pretty fast, I have a question
I have a question in regard to PHP arrays. If I create an array
I have a question with regards to automapping entity framework objects which have been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.