I have a CSV file with 31 columns and 24 rows. I need with fgetcsv (or maybe another solution) to pass in the CSV and get data column by column. I have one solution: The for loop is working but $data[$col] only gets data from the first column of the CSV, it doesn’t get data from $data[$col] when $col is
Tag: php
How to pass variables into Blade using Laravel’s Mail functions?
I have this class that takes care of emails. the $massage parameter is called from the a this class, Now i want to display the message the message in the emails.notification.blade and i tried this way this is the exception that I got. anyone with a better suggestion? Answer In your controller, the variables a…
PHP: Use Variable as Multiple Keys in Multi-Dimensional-Array
In a normal array you can select this way How about in a multidimensional? What’s the proper way to go about this? Answer i think this solution is good. note that you have to wrap all keys with “[” and “]”. Learn more about eval() function if you also want to check if the value i…
Laravel container and shared instances
I am wondering how Laravel differentiates between singletons(shared instances) and concrete implementations that might be overwritten inside the container. The container has a bind method that looks like this: It also has a singleton method that calls this function but with the $shared argument always being t…
Uncaught TypeError: Cannot read property ‘value’ of undefined in REACT JS
I am creating a login form using REACT JS as front-end and PHP as back-end. I am trying to get input values. Code is as below: And form is as below: But getting the following error: Uncaught TypeError: Cannot read property ‘value’ of undefined I am using react-toolbox. So, I am using component fro…
PHP 7 inconsistently throwing errors for division by zero
I am currently trying to understand the behavior of the new error handling in PHP 7. In the PHP Documentation for DivisionByZeroError, it states: DivisionByZeroError is thrown when an attempt is made to divide a number by zero. Fair enough, but it does not throw the DivisionByZeroError when the / operator is …
Cookie aren’t saved
I need to save a cookie, I’m trying to do this with setcookie function, I did: in the browser there is no cookie saved, why? Answer Some of your settings are wrong. I’ve corrected can you try?
Counting cart-items of specific product category
I am trying to get the number of items in the cart just from a specific product category in WooCommerce. I am doing a site for a winery. It has alcoholic and non-alcoholic products. All the wine falls under the main category of ‘wine’ or category id 34, with many subcategories and products underne…
Group by query in in laravel 5.3
I have fired this query: but I got the following error: PDOException in Connection.php line 332: SQLSTATE[42000]: Syntax error or access violation 1055 ‘baseproject_new.articles.user_id’ isn’t in GROUP BY When run the query in mysql I got the result, but when I run the page I got the error. …
mysqli_select_db() expects exactly 2 parameters
Getting the errors: Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in C:UsersrootDesktopWebServerhtdocstest.php on line 9 Warning: mysqli_query() expects at least 2 …