No dumb question, beginner need help, php

php-id-question
I have a database driven website that fetch content from the database by id, all seems to be fine with that see image …001, but if someone put a random number in the browser after the php?id= i.e. 1002 or so it shows my member’s page without data info see image …002 and last but least if someone type random characters i.e. php?id=isfdhvinsvrfinv see image sample 002 and 003, I need to redirect them back to the home page instead of showing an empty member’s page. this is the best I can explain it, I am not a professional, thanks for any help in advance.

id=96 probably causes the Database to be queried. The results of the query is shown in the page. Add an if-statement that checks if no result was found in the database for the requested ID. Then redirect.

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service