Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an error #2

Open
Chrizzor84 opened this issue Feb 11, 2019 · 3 comments
Open

Getting an error #2

Chrizzor84 opened this issue Feb 11, 2019 · 3 comments

Comments

@Chrizzor84
Copy link

Hi, I'm trying to understand and learn php, pdo and oop'ing. But on testing this class, I'm getting an error:

Fatal error: Uncaught Error: Call to a member function getAttribute() on null in C:\xampp2\htdocs\oly-app\includes\Db.class.php:218 Stack trace: #0 C:\xampp2\htdocs\oly-app\index.php(37): lib\Db->select('spelers', Array) #1 {main} thrown in C:\xampp2\htdocs\oly-app\includes\Db.class.php on line 218

The code on line 37 is:
$player = $db->select('players', ['id' => 4]);

@nikiedev
Copy link
Owner

Well, as I see the problem is with the namespace. Try to name it due to yor directory structure, it is another that I did (read about the namespace in php at first).

@Chrizzor84
Copy link
Author

Chrizzor84 commented Feb 12, 2019

Okay i took a clone of your project and its still giving me the same error.

Also, if I look in your usage.php, I see the the following code:
$db->useDatabase('articles');
which results in this error:
Fatal error: Uncaught Error: Call to a member function prepare() on null in C:\xampp2\htdocs\pdotest\lib\Db.class.php:130 Stack trace: #0 C:\xampp2\htdocs\pdotest\index.php(10): lib\Db->useDatabase('players') #1 {main} thrown in C:\xampp2\htdocs\pdotest\lib\Db.class.php on line 130

I tried reinstalling XAMPP but the problem stays the same

I'm new at the whole php and pdo world. But it looks like no data is stored in $dbh

@nikiedev
Copy link
Owner

I will check the class in my project till the end of week and write then. I hadn't the problem before. Thanks for issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants