Welcome Guest, Not a member yet? Register   Sign In
Not connecting to DB
#8

(This post was last modified: 07-13-2023, 09:27 AM by cbd.)

Great !
Thank you to you all !!
After I touched the shell of XAMPP I set up a new password which I couldn't unchange, and so I decided to uninstall and install XAMPP again.
I've looked at the table user and I didn't have the user ''@localhost, as I've seen in some foruns, it is a common MySQL problem, turning valid users to anonymous because of this empty user.
Nevertheless, I also noticed I had the .env uncommented with another password (different passwords in Database.php and .env file) so the .env file was overriding my Database.php configuration.
I just commented again those lines and now my connection worked, giving just another error of Selecting fields of objects as arrays, so I changed to View of the tutorial to this, and now it worked !

<?php foreach ($news as $news_item): ?>

<h3><?= esc($news_item->title) ?></h3>

<div class="main">
<?= esc($news_item->body) ?>
</div>
<p><a href="/news/<?= esc($news_item->slug, 'url') ?>">View article</a></p>

<?php endforeach ?>

Just a note: I connected know with the ci-news application outside of the XAMPP, using mysql xampp database to store the news.

Thank you

Now I'm just not able to open individual news page.
It is giving me a 404.

My Route.php

$routes->get('/', 'Home::index');
$routes->get('news', ['App\Controllers\News', 'index']);
$routes->get('news/(Confusedegment)', ['App\Controllers\News', 'view']);
$routes->get('pages', ['App\Controllers\Pages', 'index']);
$routes->get('(Confusedegment)', ['App\Controllers\Pages', 'view']);

I'm not really sure what is wrong, I see in older versions there is $1 after the news view path.

It tries to search for the news "elvis-sighted" for example as it was a file inside a Views folder
Reply


Messages In This Thread
Not connecting to DB - by cbd - 07-10-2023, 02:19 PM
RE: Not connecting to DB - by kenjis - 07-10-2023, 03:55 PM
RE: Not connecting to DB - by cbd - 07-11-2023, 01:17 PM
RE: Not connecting to DB - by kenjis - 07-11-2023, 07:29 PM
RE: Not connecting to DB - by JustJohnQ - 07-11-2023, 07:17 PM
RE: Not connecting to DB - by InsiteFX - 07-11-2023, 10:51 PM
RE: Not connecting to DB - by cbd - 07-13-2023, 07:36 AM
RE: Not connecting to DB - by cbd - 07-13-2023, 09:00 AM
RE: Not connecting to DB - by InsiteFX - 07-13-2023, 11:10 PM
RE: Not connecting to DB - by cbd - 07-21-2023, 12:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB