Skip to content

Kindly review my code

twitter logo github logo ・1 min read  

I added some code on github a few weeks back(My first repo, actually) and I'd love some review on it. You don't necessarily have to contribute, you could just tell me what you think I should be doing and what I shouldn't be doing. I'm still adding more code so the project isn't complete yet. Criticism and roasting are allowed. This is the URL

twitter logo DISCUSS (7)
markdown guide

Quick 'review' is that

  1. It should be best if you would separate the 'views' from the business logic
  2. The database class isn't using prepared statements so you're exposed to SQL injection of sorts.

Thanks for the review. I used prepared statements in the database class. perhaps you missed it.



My bad on the prepared statements, somehow I missed the : when doing the string concatenation on where

However I am confused about that since the docs say ->where should be used like ->where("firstname='Jessam'") , but ->where directly accepts that as the argument $this->where = $arg; and in the code you have

if(!empty($this->where)) {
    $keys = join(array_keys($this->where),"");
    $query.=" WHERE {$keys} = :{$keys}";

Oh! The where clause was originally designed to accept a string as an argument. I later updated it to accept arrays. I forgot to update the doc.

$db=parent::select("password")->from("users")->where(array("email" =>self::$email))->result();

This is how it should be used.


Seems alright to me, I saw Nigerian pidgin in your code something like loginDey(). πŸ˜…


Lmao. It's cookieDey(). Didn't know I'll be putting the code online when I did that. Thanks for the feedback

Classic DEV Post from Feb 9

What do you have to Google? Every. Single. Time.

How about you? Any other stories to make me feel better?

Samuel Jesudunsin profile image
Web developer passionate about the web. Constantly reading and learning stuff.

Do you prefer sans serif over serif?

You can change your font preferences in the "misc" section of your settings. ❀️