
Are you a QOTWer? Do you want to start a thread that isn't a direct answer to the current QOTW? Then this place, gentle poster, is your friend.
( , Sun 1 Apr 2001, 1:00)
« Go Back | See The Full Thread

For example, in my framework I've built, it'll do....
$table = "users";
$data = array('username' => $username, 'password' => $password);
$row = $core -> db -> select_row($table, $data);
'select_row' inside 'db' inside 'core' is a function that would build the sql statement, making sure that all everything in the $data array is Escaped. There are sevrel ways of doing this, but this is the most basic example that people might understand. Another one would be
$sql = $core -> -> db -> makeSQL("Select * from users where username = ? and password = ?", $username, $password);
Which would do something similar.
The bold stuff I would normally do a few things with it first, but a lot of people give that direct access to a database.
The vars and names are changed to protect the innocent.
( , Sat 16 Oct 2010, 18:31, Reply)

someone with such a tenuous grip on the English language has such an eye for coding. This is more praise than criticism I'll admit.
( , Sat 16 Oct 2010, 18:33, Reply)

Take this just as a brief example
"Jane has a cat, the cat was painted red. She threw it into a mirror until the mirror smashed"
// This is already created before this point normally
$mirror = new Object();
$cat = new Cat();
$jane = new User();
// This is the only bit I'd have to do really
while($user -> action('throw', array($cat,$mirror) ) !== $mirror->get('integraty') {
$mirror->set('integraty', 'smashed');
}
So with that, it'll tell the user to perform the action 'throw' the 'cat' into the 'mirror' until the mirror's var 'integraty' is smashed.... in this case, it would do it the once.
..... That doesn't quite make sense, but my brain deffo sees code better than english.
What I'm currently working on at work is 7gb worth of objects, views and stuff, so most of it is already written, but I have to find out exactly where it is, and make sure I don't over-write it. But in the same way if this was writting in english, I would have to find out who jane is, what a cat is and what a mirror is. In english, it's ovbouse what a mirror and cat is, and to me it is in code too, 'cus I can read it and know where to look to find it (almost like knowing the page numbers that describe the jane/mirror/cat).
( , Sat 16 Oct 2010, 18:44, Reply)

CodeIgnitor might be a better way to go about it though, you won't have to re-learn a lot, just a few core functions. I managed to learn the base of it inside a few days... it sounds like you wouldn't be too far off from me if you're already doing OOP.
( , Sat 16 Oct 2010, 19:01, Reply)
« Go Back | See The Full Thread