tjphippen.com
域名年龄: 16年2个月6天HTTP/1.1 200 OK 访问时间:2011年08月07日 00:39:36 服务器:Apache mod_fcgid/2.3.6 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 X-Pingback: http://www.tjphippen.com/wordpress/xmlrpc.php 连接:关闭 类型:text/html; charset=UTF-8 网站编码:UTF-8
About Me Cam Contact Music Pix Work ^ Old Site Not rocket science, but.. by tj on April 22, 2011 Yeah, this API is definitely pushing me, granted I didn’t put too much planning into it the first go around, but still. For the last few days I haven’t done much coding, instead I’ve been drawing everything out, the layers, all my classes & how they work with each other, it’s a lot work :/ Oh well, it’s a very good learning experience & the end result will totally be worth it :) Share on Twitter, Facebook, Delicious, Digg, Reddit 6. The Programming by tj on April 19, 2011 Finally we get to the part where I excel :) Everything else up to this point has just been the setup, the stuff I had to do even though honestly I don’t much like or am even that good with it, yep I suck at hardware and the initial setup of Linux in my opinion, but oh well. I’m going to include the database bit in this section because there’s really not that much to write about it. I’m working with MySQL(as always) and over the last few days have written out all the tables I need to create, what they contain & all my relations/joins. It’s really not too difficult, really it’s just a matter of figuring out how you want to store all the data, but most importantly how BEST to store/retrieve it. By that I mean you’ve actually got to create a schema that responds quickly, for example.. I have a “users” table, but I’m not going to store all the user’s relationships/friends in it, instead I created a “relationships” table that references both user IDs & the specific type of relationship. It’s kids stuff really :) So moving on to some actual code.. I think I mentioned it before, but if not: I’m doing everything I possibly can within objects (functions & classes). So instead of doing: mysql_connect(“localhost”, “admin”, “1admin”) or die(mysql_error());mysql_select_db(“test”) or die(mysql_error()); Everytime I need to connect to my database I created a MySQL class with functions to connect, disconnect, select, insert, update & delete. class MySQL { function Connect(){ $this->db = mysql_connect($this->host, $this->user, $this->pass) or die(mysql_error()); mysql_select_db($this->name) or die(mysql_error()); } // Excluded the rest of the functions (keeping my source for myself haha!) } Now to connect I just call: $db->Connect(); And to get a specific user’s info: $db->Select(‘users’,'id=1234′); It’s all pretty basic in the object oriented world, but surprisingly many programmers missed “that” meeting & still write everything out inline. So now I’ve got an easy way to communicate with the database, but to take things even further I’m creating classes for almost every action you can think of on a soci
© 2010 - 2020 网站综合信息查询 同IP网站查询 相关类似网站查询 网站备案查询网站地图 最新查询 最近更新 优秀网站 热门网站 全部网站 同IP查询 备案查询
2025-02-13 08:15, Process in 0.0033 second.