Kindly review my code

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 https://github.com/youngestdj/alumni

Did you find this post useful? Show some love!
DISCUSSION (7)

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.

[img]thepracticaldev.s3.amazonaws.com/i...

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

github.com/youngestdj/alumni/blob/...

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 Jun 3

Which programming language/environment is more “powerful” than people realize?

What software tool can do more than people realize or give it credit for? ...

Samuel Jesudunsin
Web developer passionate about the web. Constantly reading and learning stuff.
Join dev.to ❤️

Signing up takes about 30 seconds.

30 seconds to grow your network and level up as a developer.