Hardest Yet

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Hardest Yet

Post by Epiales »

:lol: :lol: :lol:

I didn't know where to put this, but the below took me forever to come up with LOL... The life of coding YAY

Code: Select all

$get_users = mysql_query("SELECT ranking.id as id, score, stats.attack, stats.defense, overall FROM ranking INNER JOIN stats ON ranking.id = stats.id WHERE overall>'0' ORDER BY overall ASC") or die(mysql_error());
while($row = mysql_fetch_assoc($get_users)){

Probably the hardest query of me life lol!
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Hardest Yet

Post by vitinho444 »

I never tried using Inner join, what does it do (sorry for offtopic)

PS: was this post a question?
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: Hardest Yet

Post by Epiales »

vitinho444 wrote:I never tried using Inner join, what does it do (sorry for offtopic)

PS: was this post a question?
Naw, wasn't a question... I didn't know really where to put this topic lol.... It basically allows you to call fields from two different tables in a query. And if both tables have the same id or name, then you can join them together to use them. Like in my user table, I have my usernames, but no other place do I show usernames. So I sometimes have to inner join the username with like the stats table, that holds all the player stats information. It really comes in handy.

Since all my information on the player is basically in the stats table, when I run a battle scenario, I can't just call from the stats table to get the username; I have to call from the user table to get the username. So joining stats and user tables together makes it much easier to handle the query.

The best way I know how to explain it :lol: Hope it was understandable!
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Hardest Yet

Post by Jackolantern »

Very nice! Joins are critical to master for RDBMS. I have recently come to love NoSQL databases like MongoDB, but of course they aren't right for every situation (one such example is if you need to compare all kinds of data, such as in business intelligence software).
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Hardest Yet

Post by vitinho444 »

Yap i got it thanks :)
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
Post Reply

Return to “Beginner Help and Support”