Month: December 2017

How do I get PHP errors to display?

You can’t catch parse errors when enabling error output at runtime, because it parses the file before actually executing anything (and since it encounters an error during this, it won’t execute anything). You’ll need to change the actual server configuration so that display_errors is on and the approriate error_reporting level is used. If you don’t

How to delete an element from an array PHP

There are different ways to delete an array element, where some are more useful for some specific tasks than others. Delete one array element If you want to delete just one array element you can use [crayon-5e840c24793d8737962927-i/] or alternative [crayon-5e840c24793f9818981039-i/]. Also if you have the value and don’t know the key to delete the element you can use [crayon-5e840c24793fe014218368-i/] to

How do I get a YouTube video thumbnail from the YouTube API?

Each YouTube video has 4 generated images. They are predictably formatted as follows: [crayon-5e840c2479eb4249793211/] The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of [crayon-5e840c2479ebc718920106-i/], [crayon-5e840c2479ec1267961847-i/], [crayon-5e840c2479ec5985325746-i/]) is: [crayon-5e840c2479ec9313031987/] For the high quality version of the thumbnail use a url similar to this: [crayon-5e840c2479ecd993598783/] There

How can I prevent SQL injection in PHP?

Use prepared statements and parameterized queries. These are SQL statements that are sent to and parsed by the database server separately from any parameters. This way it is impossible for an attacker to inject malicious SQL. You basically have two options to achieve this: Using PDO (for any supported database driver): [crayon-5e840c247a370231049381/] Using MySQLi (for MySQL): [crayon-5e840c247a37a509663222/] If you’re connecting