Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 1 year ago. Improve this quest…
Tag: php
accdb and PDO php connection error
I’m trying to create a simple connection using PDO (on localhost – xampp): But then I get this error: any ideas? Answer Thanks a lot vodich, here is solution:
PHP getting document path relative to site root
I’m trying to link a separate php document in the header files that contains all of the CSS link information so that if I want to change the site’s design I only have to change the css path in one …
Undefined variables in PHP template
I use PHP as a template language in my view layer, Is it possible to make the following a little cleaner and more concise? Unfortunately, we can not even define a function for that: Answer Using @ operator is the shortest alternative. Since PHP 7 you can also use the ?? operator. Which does exactly what the @…
JSONP with Laravel
Browser sends JSONP requets to Laravel, Laravel returns the results to browser. In the brower console, I get the warning: I believe this is due to improper headers in the JSONP response? How should this warning be fixed? PHP Response::JSON($result) will return the usual JSON response I believe, not the JSONP …
Display special characters returned from mySQL in drop down select box
I am trying to display utf8 characters in a drop down box which is pulled from mySQL (utf8_general_ci) the characters are returning as diamonds with a ? in the middle on. I have tried htmlspecialchars and htmlentities. And it returns a blank string. Site also has the charset set to utf-8. Thank you very much.…
Global variable is not working as expected in PHP
I’m trying to make my own simple framework in PHP. It’s going OK but I’m running into a problem. I redirect everything back to my index.php, and from there I start loading classes and functions. I split up the url into segments, which works fine, until I want to use the segments in a class. …
Email validation using regular expression in PHP
I am pretty much new with regular expression. I am developing a project in PHP and i need to validate email address. After searching in this site and google i found the following regular expression says it should work best. But when I use it I get error says, What is wrong with this code? Answer Use this inst…
the difference between unset and = null
From a random php.net post: If you are doing $whatever = null; then you are rewriting variable’s data. You might get memory freed / shrunk faster, but it may steal CPU cycles from the code that truly needs them sooner, resulting in a longer overall execution time. Apparently this is the undisputed truth…
How do I count occurrence of duplicate items in array
I would like to count the occurrence of each duplicate item in an array and end up with an array of only unique/non duplicate items with their respective occurrences. Here is my code; BUT I don’t where am going wrong! Answer array_count_values, enjoy 🙂 Result: