I have a stdclass object as shown below: stdClass Object ( [text] => Parent [values] => Array ( [0] => stdClass Object ( […
“Invalid parameter number: parameter was not defined” Inserting data
I’ve been using Yii’s active record pattern for a while. Now, my project needs to access a different database for one small transaction. I thought the Yii’s DAO would be good for this. However, I’m getting a cryptic error. CDbCommand failed to execute the SQL statement: SQLSTATE[HY093]…
Function to add dashes to US phone number in PHP
What is the best way to add dashes to a phone number in PHP? I have a number in the format xxxxxxxxxx and I want it to be in the format xxx-xxx-xxxx. This only applies to 10 digit US phone numbers. Answer EDIT: To be a bit more generic and normalize a US phone number given in any of a
PHP function with variable as default value for a parameter
By default a PHP function uses $_GET variables. Sometimes this function should be called in an situation where $_GET is not set. In this case I will define the needed variables as parameter like: actionOne(234) To get an abstract code I tried something like this: which results in an error: Parse error: syntax…
PHP get number of week for month
So I have a script that returns the number of weeks in a particular month and year. How can I take a specific day from that month and determine if it is part of week 1,2,3,4 or 5 of that month? Answer The most frustrating thing I have ever tried to get working – but here it is!
$_POST not being set
does anyone have any idea why $_POST not being set?? here is some of the code. <input type="submit" name="sub" value="…
What are the architectural limitations of PHP? [closed]
I was reading the article “PHP Sucks, But It Doesn’t Matter” by Jeff Atwood. In the comments he writes: That said, I absolutely think it’s important for PHP devs to be aware of the architectural …
What is the correct URL for MAGENTO admin
I don’t know why my magento is not working any more when I hit “http://localhost.host/amuni/admin” it says Oops! This link appears to be broken. but frontend working fine please tell me what should I do. What is the correct URL? Answer Try like this: http://localhost.host/amuni/index.php/adm…
PHP UTC to Local Time
Server Environment Redhat Enterprise Linux PHP 5.3.5 Problem Let’s say I have a UTC date and time such as 2011-04-27 02:45 and I want to convert it to my local time, which is America/New_York. Three questions: 1.) My code below might solve the problem, would you agree? 2.) But, does the value of $offset…
How do I get NULL into a MySQL integer column with PHP/MySQLi?
I’m passing values into a PHP page through the URL and using them in queries with MySQLi. The problem is that an empty string gets converted to zero for an integer column, when in fact it needs to be NULL. How do I get NULL into an integer column with PHP/MySQLi, from a param passed in the URL? Update: …