#mysql
11 November 2007
Total 18 pages. You are browsing page 3/18.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
01:27 <****> oktanouc: What data is updated, exactly?
01:27 <****> `building_1`+1 for example
01:27 <****> and a new isle score
01:28 <****> to represent the building level increase
01:28 <****> oktanouc: Sorry. I don't understand. Don't players have scores, not buildings?
01:28 <****> Erm yes, they have both...
01:28 <****> can you guys explain to me how this code works. It written as if ($res===TRUE){ echo "It works". My question is how does it know if the variable $res is TRUE if the variable $res = mysqli_query($mysqli, $sql);
01:28 <****> There score is calculated depending on there building levels
01:28 <****> for example someone with all buildings maxed out will have a score of 1000
01:28 <****> oktanouc: What determines building level?
01:28 <****> where as someone with only the main house built will have a score of 1
01:29 <****> teachme: true is a non-zero value, false is zero
01:29 <****> Xgc: building levels are user built
01:29 <****> players pay resources to build there buildigns up etc
01:30 <****> i see but if the variable $res is containing a mysql query that isn't specifically outputting an number or integer how does it determine if it is true?
01:30 <****> teachme: Although in PHP === means is equivalent and the same type. I'm not so sure it will ever work, you should try just ==
01:30 <****> lemon: its actually written that way in the tutorial
01:31 <****> I'll also pointout that there are resources and troops...each of which if I follow your suggestions would need to have there own table for levels and names also
01:31 <****> it is php code that i am using to connect to mysql
01:31 <****> teachme: Well, if mysql_query returns a valid resource then it will contain something that isn't zero. If it fails it will probably return null or false which are both equivalent to zero in PHP
01:32 <****> ah i see
01:32 <****> thank you
01:33 <****> No problem
01:33 <****> lemon: how did you learn all this?
01:33 <****> I wish i had your knowledge
01:33 <****> Hmm, I'm still not persuaded :(
01:33 <****> Endless online tutorials and by diving in at the deep end just obtaining as much experience as I can
01:33 <****> Perhaps you guys could vote on this for me please
01:34 <****> yea that's what I am trying to do just read as many tutorials as possible
01:34 <****> Should I have a seperate table for my building names which don't change during gameplay? Yes or No?
01:34 <****> As there seems to be a tad confilct on this issue
01:34 <****> oktanouc: You're right. If you don't have any need to use normalization, I guess that's your answer. You may never see the benefit. I guess it depends how fast you learn.
01:34 <****> oktanouc: My vote is all in database without any many-to-many relationships.
01:35 <****> I can see the benefit on the fact its more moduler and to me just looks nicer
01:35 <****> but I can also see the big scary disadvantage in the fact its a performance issue
01:35 <****> having to access 2 maybe 3 tables just to update a building
01:35 <****> rather than my current option of 1 table update
01:35 <****> oktanouc: Maybe you'll want to try a different approach the next time... or after this game starts seeing more load.
01:36 <****> I personally really can't see any advantage to storing static data in a database other than to make it a tad more moduler
01:36 <****> despite the fact changing a php variable and altering a table isn't going to be much of a task
01:36 <****> not a "tad" - about 100% more modular
01:36 <****> oktanouc: You may find there are different ways to track that detail.
01:37 <****> adaptr: Well no, not really...all I have to do currently is alter the isles table and add the building name to my config file
01:37 <****> with your method I'd add a row to a table
01:37 <****> oktanouc: For a small game, you may notice no difference.
01:37 <****> There's two places already where you have to change it - not quite one anymore
01:37 <****> But it'd have the disadvantage of effecing all querys
01:37 <****> you're not able to look at it from a data modeling viewpoint
01:37 <****> we do that sort of thing every day :)
01:37 <****> I don't feel it will slow down the database either.
01:38 <****> heck no
01:38 <****> I really can't see this
01:38 <****> oktanouc: Your approach can't get much worse in terms of data access.
01:38 <****> Your telling me reading 1 table and updating 2 isn't going to change things?
01:38 <****> rather than the currenyl of just updating 1 table
01:38 <****> by change things I mean performance
01:38 <****> I need some help with a MultiDB query. Both are on the same server using same UN and PW. I though syntax db.table.field would work however when using php the select db seems to hold the last DB selected even though both connections are open
01:38 <****> you said that you never changed the data, so what is there to update ?
01:39 <****> I change the building levels...
01:39 <****> Well, not me...hte code when users build
01:39 <****> SQLDarkly: Are you sure you have two new connections? I know the PHP function mysql_connect will re-use the old database connection
01:39 <****> anyone know the my.cnf setting for default engine type?
01:40 <****> you still didn't manage to look it up ?
01:40 <****> i have them currently in variables $db and $db2. They hold the connection information for each DB
01:40 <****> mikefoo: I think its storange_engine
01:40 <****> *storage_engine
01:41 <****> Just google my.cnf default engine
01:42 <****> http://dev.mysql.com/doc/refman/5.0/en/server-options.html#option_mysqld_default-storage-engine
01:42 <****> sheesh, talk about lazy
01:42 <****> no syntax errors however just says db.table doesnt exist. its reading from the wrong DB
01:46 <****> is there at least a good resource i can goto?
01:46 <****> SQLDarkly: As _Lemon_ pointed out to me the other dayh
01:46 <****> read mysql_connect on php.net
01:46 <****> you need to add true as the last option in the function
01:46 <****> to start a new instance
01:46 <****> resource mysql_connect ( [string $server [, string $username [, string $password [, bool $new_link [, int $client_flags]]]]] )
01:46 <****> see the $new_link
01:46 <****> that needs to be true
01:47 <****> else it'll use the last connection
01:47 <****> "If a second call is made to mysql_connect() with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned. The new_link parameter modifies this behavior and makes mysql_connect() always open a new link, even if mysql_connect() was called before with the same parameters. In SQL safe mode, this parameter is ignored."
01:47 <****> I need both connections to be used. in this instance wont it just select one or the other?
01:48 <****> $db1 = mysql_connect('host,'user','pass',true); and $db2 = mysql_connect('host2','user2','pass2,true) is what your looking for I think?
01:48 <****> then in mysql_query you need to tell it what instance to use
01:49 <****> i tried that but i did not have true. so the true keeps the connection open if i am understanding you correctly?
01:49 <****> no, true will start a new instance
01:49 <****> not use the previous instance
01:50 <****> ah ok
01:50 <****> *instance/link
01:50 <****> Try it...and you'll see
01:50 <****> going to read up on mysql connect now before i attempt. thanks for the push in proper direction
01:50 <****> No worries, it tripped me recently also
02:18 <****> Are varchar and text different names for the same thing ?
02:18 <****> garo: no :)
02:20 <****> then what's the main difference ?
02:20 <****> Technically I think VARCHAR(255) is identical to TINYTEXT, and VARCHAR(65535) is identical to TEXT. Or SMALLTEXT or whatever it's called.
02:20 <****> Well, maybe not identical.
02:20 <****> Varchar has a max of 255 chars, where text does not
02:20 <****> TINYTEXT has a max of 255 chars.
02:20 <****> There are some other random things that apply to it, I think.
02:21 <****> Aye, if you want to know specifically, the mysql site has a few pages on this. http://www.mysql.com .. definately worth the effort to read
Total 18 pages. You are browsing page 3/18.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
