I am new to jquery and php, I have two input fields, zip and city, the city shall output a value based from the zip that the user input. The jquery script shall call a URL: http://domain.com/city?zip.php=”zip; so that zip.php will return an echo value that will output to the city input field. I tried us…
Filter array to retain rows with smallest element count and unique first and last elements
I want to remove rows from my array so that my result is an array that contains rows with unique first and last elements. If two (or more) rows have the same first and last value, I want to preserve the row with the lowest element count. Say I have the following array: What I want is to remove all
PHP: Concatenate classes on each other
How can I concatenate a class onto another class in this manner? Keep in mind that I will always know everything in the class that needs to be concatenated ahead of time, so generalization is not an issue. Answer This will concatenate two objects together assuming they’re the same type
Access class constant and static method from string
I have a string containing the class name and I wish to get a constant and call a (static) method from that class. <?php $myclass = 'b'; // My class I wish to use $x = new x($myclass); // Create …
How to display php errors in a more readable format
I’ve recently switched from WAMP/XAMPP to LAMP and one thing I found useful was the clean, formatted error reporting. On my current server it just displays errors as plain text, and it can be hard to …
Codeigniter empty $_POST & $_FILES
I’m using Plupload to manage file uploads for my site. When I configure Plupload to post to the following test file, the records are shown correctly, however when I post to a CI controller, both $…
keep track of user page view using cookie php
I have this code here: What I’m trying to do is keeping track of the page views the current viewer using cookie. I’m a bit confused with this code because when the web visitor views the webpage for the first time, the result came back saying “Number of views: 0”, when it should be R…
How to submit a post-method form to same get-url in different function in CodeIgniter?
I found CodeIgniter form validation to show error message with load->view method, and will lost field error message if use “redirect”. Currently I use one function to show form page, and another function to deal form post. class Users extends CI_Controller { function __construct() { parent::__c…
How to get database name in PDO?
Is there a function or constant within PDO that stores the database name (the testdb value) ? I did a var_dump on $dbh and cant find anything… Answer You could use the setAttribute() (essentially a key value pair) method to store the database name when you set it up initially, then use the getAttribute(…
Where can I find a php lib for generating time-based (v1) UUID? [closed]
Where can I find a php lib for generating time-based (v1) UUID? Thanks in advance!