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 Jul 28

What Defines a "Junior" Developer? 🤷🏻‍♀️

How do you define a “Junior” Developer? Is it by the amount of experience they ...

READ POST
Follow @brendazam to see more of their posts in your feed.
Samuel Jesudunsin
Web developer passionate about the web. Constantly reading and learning stuff.
More from @youngestdj_
What do I need to know or learn to be a senior php developer?
#php #improvement #mentoring
Trending on dev.to
My Favorite PHP books
#php #books
My journey from PHP to Go
#php #go #feedback
PHP Security: Introduction
#php #security
On upcoming PHP deadlines
#php #uphpgraded #composer #wordpress
Advanced git tips
#git #github
What is PHP Airbnb Clone Script?
#php #opensource #productivity #webdev
MVPs and Iterating Your Way to a Finished Product
#opensource #npm #github
PHP Security: Passwords
#php #security #cryptography