I’ve seen a lot of examples using the php mail function. Some of them use rn as line break for the header, some use n. $headers = “From: Just Men”; $headers .= “Reply-To: Just me …
More efficient query in mysql
I want to know how do they do a query with only one textbox in the page, but the current text in the text box can be used as a parameter for the query. I’m currently using the query below but I don’t …
PHP: how can I get file creation date?
I am reading a folder with lots of files. How can I get the creation date of a file. I don’t see any direct function to get it. There are filemtime and filectime. And if the file hasn’t been modified, what will happen? Answer Use filectime. For Windows it will return the creation time, and for Uni…
control file to PHP array
In Linux, .DEB files have ‘control’ text files that are arranged as follows: What is the best way to get the control file into a PHP array resembling: keeping in mind that the values can be multi-line and include the “:” separator. Thanks! Answer Implemented as described here: http://w…
Convert this array to an HTML List
I have this array: OR Every key is the id and value is the id for the childs of this parent. ID of 0 means that (3 & 6) have no parent. Now, i want to output an HTML list like: 3 4 7 8 9 5 6 Answer Test it. or
Email from PHP has broken Subject header encoding
My PHP script sends email to users and when the email arrives to their mailboxes, the subject line ($subject) has characters like a^£ added to the end of my subject text. This is obviously and …
How to get rid of MySQL error ‘Prepared statement needs to be re-prepared’
I’ve rewritten my site php-code and added MySQL Stored Procedures. In my local version everything works fine but after I uploaded my site to hosting server I’m constantly getting fatal error ‘Prepared …
regular expressions: how to find the bit between the “”
In the following string, Jason How can i extract the part inside the angle brackets. I tried and it didn’t work. Ideas? I’m using preg_match() in php if that …
How do I check if a string contains a specific word?
This question’s answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions. Consider: Suppose I have the code above, what is the correct way to write the statement if ($a contains ‘are’)? Answer Now with PHP 8 you can…
PHP PDO: charset, set names?
I had this previously in my normal mysql_* connection: Do I need it for the PDO? And where should I have it? Answer You’ll have it in your connection string like: HOWEVER, prior to PHP 5.3.6, the charset option was ignored. If you’re running an older version of PHP, you must do it like this: