Skip to content

Tag: php

Is there any better way to get Currency Exchange Rate in PHP?

Currency Exchange Rate with below code is working sometimes and not working sometimes and not at all reliable. Is there any better way to get Currency Exchange Rate in PHP? Answer You have several issues: You’re not calling an actual API, you’re scraping a web page, which means that: you’re …

PHP how to do math in foreach cycle

I have a dynamical fields that contains values and i need to do math with them. What is the way to do it in foreach, do i have to save each value at the end of each loop? Example there is 4 fields: What i have is that I print these dynamical values into table and the table adapts users

Yii2: How to redirect to with UrlManager?

In my Yii2 config I have: If I go to site.com/search it works. If I go to site.com/site/index it also works and shows the same content. How to redirect the call instead of just showing the response of site/index? It must also redirect with params (site.com/site/index?param=1 -> site.com/search?param=1) Ans…

How can i take the element name inside the Html

How can i able to find the date format in UTC from the html element 2018-06-14T03:00:00.000Z. I am new in php so i don’t know how to grab it. Answer You might do it using find for getting the div with classname fi-mu__info__datetime and then getting the data-utcdate: If you only want the first one you c…

Apache2 is not working

I use Linux Mint. When I try to restart apache displays next message. Job for apache2.service failed because the control process exited with error code. See “systemctl status apache2.service” and “…

PHP Symfony Many to Many form

I have a many-to-many relationship between two tables in my database (1 artikel has more than 1 bestelling and vice versa), so I made a link table(bestelregel). But now I want to make a form so that I can add a new order with multiple products, but as I am new to this, I am not sure how to do

SilverStripe 4 custom error page not shown

In my last project on SS 4, I’m trying to create my usual custom error pages – with same approach used on v. 3: Creating ErrorPage.ss inside /themes/mysite/templates/Layout; Including $Content inside template; After a successful /dev/build?flush=all I don’t see any content, neither right tem…