Browser MMO Video#2
-
- Posts: 3
- Joined: Sun Aug 05, 2012 8:00 am
Re: Browser MMO Video#2
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.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Browser MMO Video#2
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?
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
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.
It's best to develop a style you are comfortable with and stick with it.
Re: Browser MMO Video#2
Even the " ` " don't change anything ?
Btw, I can't use ã or ç ?
Btw, I can't use ã or ç ?
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Browser MMO Video#2
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.
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
Re: Browser MMO Video#2
" " 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.
' ' 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.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Browser MMO Video#2
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
Re: Browser MMO Video#2
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
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
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Browser MMO Video#2
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
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
The indelible lord of tl;dr