Page 12 of 13
Re: Browser MMO Video#2
Posted: Sun Aug 05, 2012 9:51 pm
by kaitokid89
Re: Browser MMO Video#2
Posted: Sun Aug 05, 2012 11:28 pm
by Jackolantern
Np! Glad you got it worked out

Re: Browser MMO Video#2
Posted: Fri Aug 10, 2012 11:24 am
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?
Re: Browser MMO Video#2
Posted: Fri Aug 10, 2012 1:14 pm
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.
Re: Browser MMO Video#2
Posted: Fri Aug 10, 2012 6:58 pm
by Aerithcal
Even the " ` " don't change anything ?
Btw, I can't use ã or ç

?
Re: Browser MMO Video#2
Posted: Fri Aug 10, 2012 7:12 pm
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.
Re: Browser MMO Video#2
Posted: Fri Aug 10, 2012 7:14 pm
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.
Re: Browser MMO Video#2
Posted: Fri Aug 10, 2012 7:17 pm
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.
Re: Browser MMO Video#2
Posted: Fri Aug 10, 2012 7:21 pm
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
Re: Browser MMO Video#2
Posted: Fri Aug 10, 2012 7:26 pm
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
