I solved a problem I had with the routes in views, if you are using something like xampp I don't think the views will work anymore, so let me know if this happens.
PersonController fixing
This must be my third time writing this, so maybe it is a bit too long to explain.
Let's go, as I said before the class was being created but not used in any moment, so the first thing I did was instantiate the class:
I saw that in the _construct of the class I needed to pass the $conn that was its connection to the database, so I used the require to get the config.php that there was the $conn.
With this done then I could already use the functions inside the class, but reading the functions it seemed to be using the Persona model too, so I gave a require on it just to make sure.
OK, everything ready, now I just need to use the functions, but then, how would the code know if it's to update, or add something for example? Simple, in your form you're already passing a value for that, I just need to use it:
So to use it, I did the simplest and a little dirty way, a chain of if to know what I need to do, then I use the function passing the data that came from the post:
I think that's it, I think there are several improvements you can do in your code, and I also think that using discord for conversation would be more practical
Views fixing
I solved a problem I had with the routes in views, if you are using something like xampp I don't think the views will work anymore, so let me know if this happens.
PersonController fixing
This must be my third time writing this, so maybe it is a bit too long to explain.
Let's go, as I said before the class was being created but not used in any moment, so the first thing I did was instantiate the class:
I saw that in the _construct of the class I needed to pass the $conn that was its connection to the database, so I used the require to get the config.php that there was the $conn.
With this done then I could already use the functions inside the class, but reading the functions it seemed to be using the Persona model too, so I gave a require on it just to make sure.
OK, everything ready, now I just need to use the functions, but then, how would the code know if it's to update, or add something for example? Simple, in your form you're already passing a value for that, I just need to use it:
So to use it, I did the simplest and a little dirty way, a chain of if to know what I need to do, then I use the function passing the data that came from the post:
I think that's it, I think there are several improvements you can do in your code, and I also think that using discord for conversation would be more practical