Jump to content

Basic MySQL Question.


TexasMd91

Recommended Posts

Hello, Is there a way to only get 1 row out of a table without outputting the rest of the rows?

 

I am guessing it would be done in the query, so here is my query.

 

$query  = "SELECT player_id, player_name_uncolored, player_games_played, player_total_efficiency, player_total_kills, player_total_deaths FROM players";

Lets say I want to output only if the player_id = 1

 

How would I go about doing it?

 

 

I know I could just do a loop, and use a IF Statement inside of it to see if its 1. But is there a better way of doing this?

 

Cause ATM, There is currently 11635 player_id, and doing it that way would probably put to much stress on it if its doing the script every few seconds. and plus it would probably take a few seconds longer.

Link to comment
Share on other sites

use WHERE

 

$query  = "SELECT player_id, player_name_uncolored, player_games_played, player_total_efficiency, player_total_kills, player_total_deaths FROM players WHERE player_id='1'";

 

That should work ;D

 

~ Chocopi

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.