SQT11 / Universidad

Creacion de una pagina web , con mysql , html ,php , css , mas crud ( En desarrollo Tarea), Para una universidad cualquiera,
1 stars 0 forks source link

Views route fixing and PersonController fixing #7

Closed carlosdaniel26 closed 1 year ago

carlosdaniel26 commented 1 year ago

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: image

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. image

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. image

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: image

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: image

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