Redirect vs RedirectMatch

Redirect is supposed to redirect all URLs starting with the string. Since the URL you redirect to started with that string, naturally you instantly redirected again. RedirectMatch redirects URLs that match a regular expression. You used $ to explicitly match the end of the URL as part of that. That means that “starting with” is not enough.

What are .tpl files? PHP, web design

That looks like Smarty to me. Smarty is a template parser written in PHP. You can read up on how to use Smarty in the documentation. If you can’t get access to the CMS’s source: To view the templates in your browser, just look at what variables Smarty is using and create a PHP file that populates the used … Read more

How to listen messageSent event in laravel 5.5

You can pass data from the controller to the mailable, and then from the mailable to the listener For example I have a model called SendOrder that I use to keep track the status of the email, so I pass this model from the controller to the listener This is what you have to do from scratch … Read more

break out of if and foreach

if is not a loop structure, so you cannot “break out of it”. You can, however, break out of the foreach by simply calling break. In your example it has the desired effect: Just for completeness for others that stumble upon this question looking for an answer.. break takes an optional argument, which defines how many loop structures it should break. Example: … Read more

PDO bindParam() with prepared statement isn’t working

Using bindParam() the variable is bound as a reference. A string can’t be passed by reference. The following things can be passed by reference: Variables, i.e. foo($a) New statements, i.e. foo(new foobar()) References returned from functions Try using bindValue()

laravel updateOrCreate method

In your use case, you should specify a second parameter. The first indicates the conditions for a match and second is used to specify which fields to update. Here is an example from the documentation: https://laravel.com/docs/5.4/eloquent

PHP $_SERVER[‘HTTP_HOST’] vs. $_SERVER[‘SERVER_NAME’], am I understanding the man pages correctly?

That’s probably everyone’s first thought. But it’s a little bit more difficult. See Chris Shiflett’s article SERVER_NAME Versus HTTP_HOST. It seems that there is no silver bullet. Only when you force Apache to use the canonical name you will always get the right server name with SERVER_NAME. So you either go with that or you check the host name against a white … Read more

Multiple file upload in php

I know this is an old post but some further explanation might be useful for someone trying to upload multiple files… Here is what you need to do: Input name must be be defined as an array i.e. name=”inputName[]” Input element must have multiple=”multiple” or just multiple In your PHP file use the syntax “$_FILES[‘inputName’][‘param’][index]” Make sure to look for empty … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)