Does anyone know how to sort an array into alternating smallest largest values? I.E. Array (10, 2, 5, 1, 30, 1, 7) Should be : (30, 1, 10, 1, 7, 2, 5) EDIT: Forgot to mention the arrays are …
PHP Database writing performance PDO VS ORM
We need to insert records in mysql quite fast for the purpose of syncing it with an other database. Which performs faster inserts. PHP PDO or some ORM (propel/doctrine)
PayPal IPN losing session on return?
I’m using Micha’s PayPal IPN script and for the most part it worked great: https://github.com/Quixotix/PHP-PayPal-IPN When i click Pay now on the website it redirects to paypal with correct …
Database Driver MySQLi Error
I am running Moodle test environment on Window Vista having PHP 5.2.10 and MySQL 5.1.36-Community. When I upgrade from Moodle 1.9.9 to 2.0, I am getting the following error. I also tried to change the dbtype=’mysqli’ in config.ini and still see same error. I would really appreciate if you can prov…
permission denied – php unlink
I have two files: b.php and test.txt and the error is: Warning: unlink(test.txt) [function.unlink]: Permission denied why? b.php and test.txt is 777 and the same group/login if I set 777 on the parent directory I can execute unlink but i have to set 777 and back to 755? Answer You (as in the process that runs…
How to redirect the user to detail page after saving a new pod item/record in Pods / WordPress?
After saving a new pod item, I want to redirect the user to the detail page of the newly created record. How can I achieve this? I tried using post_save hooks but it didn’t work. I used the following code: The pod item is created by a shortcode like this: Answer Try this: [pods name=”egitim”…
Extract compressed text from MediaWiki database with PHP
A client of ours would like to have all the contents from a wiki site they ran for a while. They provided us the complete database of the ‘mediawiki’ software. We are trying to extract the articles …
PHP naming conventions about abstract classes and interfaces
Should an abstract class always be prefixed with Abstract and suffixed with Interface (when it’s an interface)? Is there any standard naming convention, similar to PSR-0 for folder structure/namespaces, but for classes? It seems redundant as the language has literal keywords for this very purpose. Answe…
How to use $_SESSION variable to retrieve data and display it in another page [closed]
Below I have a php script where it displays a “Course” drop down menu and a “Module” Drop down menu. What is suppose to happen is the user first selects a course from the “Course” drop down menu and …
Google Code Prettify with Markdown is not working
Google Code Prettify is working fine, but when I am using the Markdown content and show the content from the database, Prettify isn’t working properly (link of live result). This is what I am doing: Getting content with <textarea name=”article_content” id=”wmd-input” class=…