Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

OOP in PHP

Name: Anonymous 2011-03-23 17:37

Ok, so I'm working on a project ( and yes it is for a class ) I come from a strong background in java, so this project is a bit odd to me, it being in PHP. I learned about the MySQLi interface and it makes a lot of sense to me, so what I'm trying to do is write a PHP class to do all the backend stuff for my site so that my main pages can just call $site->functionThatDoesSomething(); to get whatever needs done accomplished. the problem I'm having is with database connections. in java I'd do something like this http://pastebin.com/5Wezenk9
but since php is loosely typed I have no idea how to do that. Any tips would be appreciated, or perhaps a better guide to oop in php....

Name: Anonymous 2011-03-23 17:51

Stop using PHP, godfuqindamn.

Name: Anonymous 2011-03-23 17:54

I would if I could, I'd much rather be doing this in ASP or JSP....

Name: Anonymous 2011-03-23 18:47

Hold on, how the fuck does PHP's typing system affect anything about this? You can program in PHP pretty much exactly like you would in Java.

Name: Anonymous 2011-03-23 19:32

http://pastebin.com/cE3qztCG
I am not too good with MySQLi, I use SQLite3 now.

Name: Anonymous 2011-03-23 19:51

http://pastebin.com/ARB5YU6e

If I understood you right, you want something like this.

Just saw the other reply. As mentioned sanitize, nobody likes dirty input.

Name: Anonymous 2011-03-23 19:52

Coming from a Java is probably the worst programming background to come from, I sense you're already wanting to build a factory factory abstract factory, n-factory monstrosity of some sort. Stop writing boiler plate abstractions and just code.

Name: Anonymous 2011-03-23 20:37

>>7
Java is fine for beginner stuff, the only thing that results in good code is lots of experience.
Most new Java programmers don't have experience, because they just graduated from high school.

Name: Anonymous 2011-03-23 22:46

>>7
Coming into Java is the pleasure of.

Name: Anonymous 2011-03-24 0:15

>>9
being cummed inside.

Don't change these.
Name: Email:
Entire Thread Thread List