Is there any way how to invoke a PHP page / function when a record is inserted to a MySQL database table? We don’t have control over the record insertion procedure. Is there a trigger mechanism which can call a PHP script back? Answer The trigger is executed on the MySQL server, not on the PHP one (even…
Tag: php
secure and resume support file downloading with php
I want to give permission to some of my website users to download a specific file. the download needs to be resume support just for user convenience. For that reason it came to my mind to secure the file with this piece of code: the problem is that not only it’s not resume support also it’s gonno …
How to split a string by multiple delimiters in PHP?
“something here ; and there, oh,that’s all!” I want to split it by ; and , so after processing should get: Answer
Mcrypt installed but doesn’t show up on PHPINFO
I think I managed to install mcrypt lib. The files are in place, but it looks like the library doesn’t run at all. Tried to add: to PHP.INI; no good. Any help? Answer Have you tried restarting Apache? It won’t recognise the new installed module until you do so AFAIK. Also, you’ve written you…
How to define an empty object in PHP
with a new array I do this: Is there a similar syntax for an object Answer A comment in the manual sums it up best: stdClass is the default PHP object. stdClass has no properties, methods or parent. It does not support magic methods, and implements no interfaces. When you cast a scalar or array as Object, you…
How can I see what variables are sent from flash to a PHP script?
I was wondering how I could see what variables my flash sends to my PHP script. Is that possible? Maybe an extension or something else? I don’t know if my flash is sending any variables. My problem is that I have a flash which I can’t change and the flash has a form. In that form the variables are…
.htaccess 301 redirect of single page
After a site redesign, I’ve got a couple of pages that need to be redirected. Everything is staying on the same domain, just a couple of things have been reorganised and/or renamed. They are of the form: /contact.php is now: /contact-us.php Using the .htaccess file, I’ve added this line, which is …
PHP: Built-in function to check whether two Array values are equal ( Ignoring the order)
Is there a built-in function for PHP for me to check whether two arrays contain the same values ( order not important?). For example, I want a function that returns me true for the following two inputs: Edit: I could have sorted the two arrays and compare them, but as I am such a lazy guy, I would still prefe…
What is the best way to split a string into an array of Unicode characters in PHP?
In PHP, what is the best way to split a string into an array of Unicode characters? If the input is not necessarily UTF-8? I want to know whether the set of Unicode characters in an input string is a subset of another set of Unicode characters. Why not run straight for the mb_ family of functions, as the firs…
Is there a good implementation of partial file downloading in PHP?
I’m writing a PHP script that allows the user to download a file. Basically the idea is to prevent the file being downloaded more than X times, since it is paid content, and the link should not be spread around. Since the files will be pretty large, it should be good to implement resuming. I’ve re…