I’m learning php and I’m having trouble connecting to a database in mysql. my code - https://pastebin.com/SV0cTbcd I’m not sure what I’m doing wrong here or how to trouble shoot this since no error is showing up, I’m only having the error being catched so in my browser ‘cant connect’ keeps showing up instead of whats in my database. My dbname is correct so I think something is wrong with the mysql:host=127.0.0.1, but I’m not sure and don’t know how to check how to fix it. I’d appreciate any help with this.
EDIT when I changed <?php 'mysql:host=localhost; ? > this line of code to localhost instead of 127.0.0.1, I’m not catching an error anymore, but my rows in my database aren’t showing and I’m not sure why. Is there any way to confirm my database is connecting correctly or am I printing the database rows incorrectly?