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

  • Home
  • SEARCH
  • 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 305161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:20:52+00:00 2026-05-12T07:20:52+00:00

How do i go about looking into a table and searching to see if

  • 0

How do i go about looking into a table and searching to see if a row exist. the back gorund behind it is the table is called enemies. Every row has a unique id and is set to auto_increment. Each row also has a unique value called monsterid. the monster id isn’t auto_increment.

when a monster dies the row is deleted and replaced by a new row. so the id is always changing. as well the monsterid is changed too.

I am using in php the $_GET method and the monsterid is passing through it,
basically i am trying to do this

$monsterID = 334322 //this is the id passed through the $_GET

checkMonsterId = “check to see if the monster id exist within the enemies table”

if monsterid exist then
{RUN PHP}

else
{RUN PHP}

If you need anymore clarity please ask. and thanks for the help in advance.

  • 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-05-12T07:20:52+00:00Added an answer on May 12, 2026 at 7:20 am

    Use count! If it returns > 0, it exists, else, it doesn’t.

    select count(*) from enemies where monsterid = 334322
    

    You would use it in PHP thusly (after connecting to the database):

    $monsterID = mysql_real_escape_string($monsterID);
    $res = mysql_query('select count(*) from enemies where monsterid = ' . $monsterid) or die();
    $row = mysql_fetch_row($res);
    if ($row[0] > 0)
    {
        //Monster exists
    }
    else
    {
        //It doesn't
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently learned about Recursive Common Table Expressions (CTEs) while looking for a way
I am looking to copy a single row from one identical table to another
I am having a table which has about 17 fields. I need to perform
I'm looking into rendering more complex responses. Specifically, I am searching for options for
I'm looking to learn about embedded programming (in C mainly, but I hope to
i'm looking to learn about SSO, and heard about Sun Access Manager and openSSO(?)
I am looking for information about providing a license, or terms of use, for
I remember looking at D about 2 years ago, and it looked nice, was
I'm looking for some quick thoughts about a business application I am looking to
I was just looking through some information about Google's protocol buffers data interchange format.

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.