Jump to content

checking to see if record exist


lilgezuz

Recommended Posts

I need to check my database to see if a user has earned a trophy.  I have a table that holds the user id, game id, trophy id, and date earned.

 

When I go to run my cron job It pulls data that may already be in my database so I need to check if a user has earned that trophy id for that game id.  There is multiple game ids and each game id could have the same trophy id for example

 

game 1 trophy 1

game 1 trophy 2

game 2 trophy 1

game 2 trophy 2

 

I tried to use mysql_num_rows but its not working for me

Link to comment
Share on other sites

well i assume you had vars in for the username and trophyid... and actually, hope you are using a userid rather than a username.

 

mysql_num_rows works... as long as it is used right. we can't help you without knowing what "not working" means and what the query is when it is not working.

Link to comment
Share on other sites

well i assume you had vars in for the username and trophyid... and actually, hope you are using a userid rather than a username.

 

mysql_num_rows works... as long as it is used right. we can't help you without knowing what "not working" means and what the query is when it is not working.

 

the username is a id the tid and gameid are numbers.

 

not working means that its not returning and results when it should be.  I posted the query in my above post

Link to comment
Share on other sites

well then you have the problems i mentioned in my last post..

 

if that is the query you are using (as you say it is).. the only way you're going to have any result is if you have a "username" as a value in the "userid" field, and "trophyid" as a value in the "trophyid" field... which doesn't make any sense

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.