Codeigniter Blank Screen

There’s also Symfony you know :slight_smile:

Given the choice I’d personally always go with that.

Your swimming in the wrong pool my friend. A framework of any sort is not the place to start learning OOP, or any other technology What you are really learning is how to use X framework, not necessarily OOP, although you are using it.

I would highly recommend you start with learning the basic concepts of Object Oriented Programming. Start with some basic concepts like how to write a Class, Visibility, Dependency Injection, etc…

Since you have an interest in a “multilevel user login system”, perhaps write it up in procedural. When you have it finished and essentially bug-free then start refactoring it to OOP.

2 Likes

That does not seem right because WHERE is missing.

I would be tempted to create two cases:

Case #1:

$sql    = "SELECT * from `dealers` WHERE email='$email` AND `password`='$password' ";
$result = $this->db->query($sql);
echo '<pre>'; var_dump($result); echo '</pre>';
die;
  1. pass a SQL Query and examine the results for a non-existent user
  2. valid user with incorrect password
  3. valid user with a correct password.

Case #2:

Try to use CodeIgniter’s Query Builder and get the same results.

John, your Case #1 won’t work when using password_hash as that can give different results for the same password when running it multiple times. You need to select the password rrij the database and then verify using password_verify.

That is a very valid point. And i have been reading OOP on the side of building this project.
In regards to the multiuser login system, i have actually got this in procedural and working however i’m just trying to rebuild the project in a framework & MVC as its scaling up quickly and since working with CI my procedural looks so messy lol.

Hey John

According to the CI docs, that method just returns the SQL query as a string.
Query Builder

$sql = $this->db->get_compiled_select('mytable');
echo $sql;

// Prints string: SELECT * FROM mytable

Thanks for the advice. I may give that a go in the future however for now i’m keen on getting to grips on the CI framework. ;).

My mistake, guessing from a tablet.

Try last_query which should show details of the WHERE clause:

https://codeigniter.com/userguide3/database/helpers.html?highlight=last_query

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.