Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Securing php data

Featured Replies

Hello,

 

So I have two questions :p

 

1. What is a safe way to retrieve data from a database and then later for output. So I insert some data in a form and place that in the database, what is then the safest way? By insert using htmlentities or by outputing?

 

2. So I have an item with an itemnumber in the url like this:

 

localhost/Project/items.php?itemnumber=12

 

 

How can I secure this with PHP, so when you would typ in a quote for example, that the data is sanitized, so I can prevent SQL injection!

 

localhost/Project/items.php?itemnumber='DROP DATABASE';

 

Cheers :D

 

I think your best bet is to use PDO or Mysqli with prepared statements and parameterized queries. (LINK) These take care of quote handling for you. Obviously, there will be other methods for injection, some further info:

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.