I recently realized my currently approach on a project would greatly improve with the use of better/more descriptive objects. As such, I realized that I want an array of objects to be a member of another class. Edit: I wasn’t clear as to what my question was. My question is thus: How do I have an array …
Inserting a multi-dimensional php array into a mysql database
I have an array from a csv with a similar structure to this: I would like to insert it into a MySQL table where the items of the first array (name, age, gender) are the column titles and each subsequent array is a row in the table. Could anyone advise as to the best way to do this? Answer The
PHP: delete the first line of a text and return the rest
What’s the best way to remove the very first line of a text string and then echo the rest in PHP? For example. This is the text string: This is the final output: If I was working with a file in Bash I could do easily the next: sed -i~ 1d target-file Or: tail -n +2 source-file > target-file Any
Detecting potential SQL injection attacks, as well as other security issues
We all know it is nearly impossible to produce a large website without one or two flaws. As such I’ve written a small monitor that checks Apache access logs for potential SQL injection attacks (…
Communicate between pop up window and the parent window
I’m working on a PHP/MySQL project using Codeigniter framework. The user fill a form with many data, and give me also FTP access to his web hosting, I want to POST FTP details to a popup after clicking Browse button, user will select a path (I’m using Codeigniter FTP Class), then I’ll grab t…
Godaddy cron job setup for running php script
can you help me setup cron job on godaddy webhosting? I have php file that i need to run, it is located in cron subdirectory (so address is http://test.com/cron/file.php). What do i need to write in command input field, so this file is runned? Answer NOTE: GoDaddy has been migrating all hosting packages over …
PHP – How to remove empty entries of an array recursively?
I need to remove empty entries on multilevel arrays. For now I can remove entries with empty sub-arrays, but not empty arrays… confused, so do I… I think the code will help to explain better… Ok, this code will remove “nickname”, “birthdate” but is not removing “…
Doctrine 2 + unsigned value
Is it possible to specify a column type of unsigned integer in Doctrine 2? Answer You can but you will loose portability. Use columnDefinition attribute and set it to integer unsigned. The actual code depends on what you are using. columnDefinition: DDL SQL snippet that starts after the column name and specif…
PHP preg replace only allow numbers
How can I modify this existing preg_replace to only allow numbers? Answer I think you’re saying you want to remove all non-numeric characters. If so, D means “anything that isn’t a digit”:
Fatal error: Maximum execution time of 300 seconds exceeded
I keep getting this PHP error: Fatal error: Maximum execution time of 300 seconds exceeded I have tried setting my max_execution_time and my max_input_time settings in php.ini (both apache and cli)…