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 …
Tag: php
How to create a function in twig to calculate the age of a person using Symfony
I have this PHP code that works but I would like to be able to use the same but within twig in symfony. Answer To make this code guide me in this post: https://es.stackoverflow.com/a/73288/6524 The only variant in the file EdadUsuarioExtension.php
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…
Laravel multi result set query builder
I have a MSSQL stored procedure : And i am executing this with my laravel app : It just returns me the first SELECT query result. How can i get both result sets? Answer Solved by writing bellow function :
Ajax add to cart button for product variation in WooCommerce 3
I have this button here. The use of this button is to add to cart a product has a product id of 237, variation id of 208673, and attribute_pa_option of bluetooth. Is there a way to AJAX this?
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…