Browser MMO Video#2

Location of the Videos
kaitokid89
Posts: 3
Joined: Sun Aug 05, 2012 8:00 am

Re: Browser MMO Video#2

Post by kaitokid89 »

:D :D :D
I misread the table name my table name is "player" but in test.php I write it "players"
thanks dude, I'm gonna go back to the drawing board. :lol: :lol: :lol: :lol:
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Browser MMO Video#2

Post by Jackolantern »

Np! Glad you got it worked out :)
The indelible lord of tl;dr
Aerithcal
Posts: 12
Joined: Fri Aug 10, 2012 10:09 am

Re: Browser MMO Video#2

Post by Aerithcal »

Well everything went good.

I have a question, in the tutorial I was following before, the user instead of :

$playerinfo = "select * from player where name = 'player1'";

Was using things like this:

$playerinfo = "SELECT * FROM `players` WHERE `name` = 'player1'";

It's equal? Is it just to turn the code more easier to see?
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Browser MMO Video#2

Post by OldRod »

Yes, it's the same. Capitalization on the MySQL commands just makes things easier to read for some people.

It's best to develop a style you are comfortable with and stick with it.
Aerithcal
Posts: 12
Joined: Fri Aug 10, 2012 10:09 am

Re: Browser MMO Video#2

Post by Aerithcal »

Even the " ` " don't change anything ?

Btw, I can't use ã or ç :( ?
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Browser MMO Video#2

Post by Jackolantern »

The capitalization makes no difference, however the back-ticks ( ` ` ) do. SQL is smart enough most of the time to recognize the name of something in the database, like a table or column name. However, you can mess it up if you have spaces in your names, or if you use reserved words in SQL, such as "select" or "order". Many people simply put back-ticks around every name they put in their queries so they won't have to think about whether their names are going to mess-up the query.

About the special characters, I really don't know since I have had no reason to use them before. Try putting back-ticks around any name that uses them, and see if that allows it to accept them. I think those are included in the ASCII standard, so I don't know why it wouldn't accept them considering that ASCII is about the most restrictive character set in use anywhere today.
The indelible lord of tl;dr
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Browser MMO Video#2

Post by OldRod »

" " goes around string values

' ' goes around string data you are inserting into a table or in a query.

`` (the Tilde key on your keyboard... not to be confused with the single quote '' :)) goes around table/field names in a query string.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Browser MMO Video#2

Post by Jackolantern »

Yeah, I probably should have mentioned the other two. He is correct, and I guess I didn't spell it out clearly: You don't add the back-ticks around everything (even though I think legally you can). They go around the names of fields and tables.
The indelible lord of tl;dr
Aerithcal
Posts: 12
Joined: Fri Aug 10, 2012 10:09 am

Re: Browser MMO Video#2

Post by Aerithcal »

Yes thank you both, I totally understood it.

Since I'm portuguese, and portuguese is a hard language, if I try portuguese words like "usuário" (username) it gives error :p but no problem at all, i'll just make it english xD
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Browser MMO Video#2

Post by Jackolantern »

No problem! :)

Too bad about the Portuguese characters, though. I think a lot of developers end up using English words in databases and other places. Although it strikes me as odd a database engine can't even support basic Extended ASCII :P
The indelible lord of tl;dr
Post Reply

Return to “Older Browser MMO Videos”