I have an abstract class defined as follows:
abstract class Abstract Parent extends Zend_Db_Table_Abstract {
abstract function funcA($post);
abstract function funcB();
public function newEntry($post) {
$t1 = $this->funcA($post);
$t2 = $this->funcB();
}
}
The child class defines the two abstract methods, a...
I'm trying to make a versioning system for database entries. I thought of fully storing only the last version of an entry and using reverse-deltas for storing the changes.
While there is a lot of wiki software that has a diff function, i found none that has a patch function. How do they revert to an older version of an entry?
I'm asking ...
I have this code to send data:
function insert_new_image()
{
var ids = [];
$('.be-imagecontainer').each(function(i){
ids[i] =$(this).find('span').text();
});
var jsonids = {'ids' : ids}
var url = base_url + 'ajax/get_new_images';
$.ajax({
url : url,
data : {'ids' : jsonids},
suc...
I'm trying to get a date that is one year from the date I specify.
My code looks like this:
$futureDate=date('Y-m-d',strtotime('+one year',$startDate));
It's returning the wrong date.... any ideas why?
Thanks!
...
Using a wildcard so all records will be matched.
My code:
if(empty($tag))
{
$tag="%";
}
mysql_query("select * from mytable where instr(tag,'$tag')>0") or die(mysql_error());
But it returns zero result.
Even if
if(empty($tag))
{
$tag="*";
}
It still returns zero result. How to resolve this problem?
...
this is my code:
<input type="text" name="text[]" />
<input type="text" name="text[]" />
<input type="text" name="text[]" />
if (!empty($_POST['text'])) {
foreach ($_POST['text'] AS $value) {
// add to the database
$sql = 'INSERT INTO tableName SET fieldName = "' . mysql_real_escape_string($value) . '"';
}
}
I want this to o...
Hello,
How do i edit a xml files and add a new entry at end of < / user > ?
My xml(filezilla) look like
<FileZillaServer>
<Users>
<User Name="test">
</User>
/* using php to add another users on here <User Name="test2" */
</Users>
</FileZillaServer>
Thank you for help.
...
Hello!
I'm writting an application using Zend_Framework (so the solution can rely on it).
How to get client's timezone?
For example, if someone in Moscow, Russia, I want to get 3*60*60 (because there is UTC+3). If he is in UK, I want zero. If he uses UTC-3:30 (Canada?), I want -3.5*60*60.
(it's not a question about a format - I'm ok ...
Is it possible to have multiple versions of PHP running on the same box ( like rails ) . Here is my problem , I need to start development on a new project and was planning to use PHP 5.3 for it so that I can use the latest Zend framework and active record with it . However the machine where I need to host my application has PHP 4.4 and ...
Consider the following code:
class myclass
{
function __construct(&$arg1, &$arg2)
{
echo $arg1;
echo $arg2;
}
}
How do I know that constructor above has arguments passed by reference through code?
Edit:
I am looking for detecting of they are passed by reference programatically something like this:
is_passed_by_ref(...
Hello There,
In the minutes php6 developer meeting, i came across a point where it said that call-time-pass-by-reference is no longer there in PHP6. For example, following both are incorrect for PHP6:
<?php
$foo =& new StdClass();
?>
<?php
function &foo()
{
return new StdClass();
}
$f = foo();
?>
If we can't use something like ...
I have array like
Array (
[608665839] => Array ( [score] => 2 )
[1756044141] => Array ( [score] => 5 )
[523536777] => Array ( [score] => 2 )
)
and I want to sore this array by score. How can I do?
...
So I'm having trouble with unit testing CakePHP models. Simple stuff like writing tests that my validation rules are catching errors etc.
To begin with, I have a model called NewsItem. Its defined in my MySQL database using the following schema
CREATE TABLE news_items (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
title VARCHAR...
Is there any free script in PHP/MYSQL or in ASP.NET/SQL Server for comment reply system like intensedebate.com. In intensedebate we can reply to any comment or reply. I need the similar free script which I can modify according to my website needs.
Please let me know if anybody knows any system like this or if anyone has some concept whi...
I am creating a wap portal, and wanted to know if Opera Mini supports gzip encoding?
However, does
ob_start("ob_gzhandler");
automatically check if the browser supports gzip and sends the gzipped encoded content or do we need to check that manually ?
...
Hello,
The below function generates error when a function contains referenced arguments eg:
function test(&$arg, &$arg2)
{
// some code
}
Now I can not use call_user_func_array for above function, it will generate an error.
How to solve this problem?
I do need to use call_user_func_array.
Also assume that i don't know beforehand...
Hi,
I am creating a very custom form on a symfony project and currently I have something like this:
foreach ($foo as $c) {
$fields['crit_v_'.$c->getId()]=new sfWidgetFormInput(array('label'=>''));
$fields['crit_m_'.$c->getId()]=new sfWidgetFormTextarea(array('label'=>__($c->getName(),array(),'messages')));
}
As you can ...
i want to redirect all traffics coming from thailand to another domain
how can i do this in php ?
...
How would you go about implementing an array design and function to achieve the following table in php. The data would be drawn from a mysql database but i would like to limit the number of mysql queries required and therefore use a formatted array of some sort.
-----------------------------------------
| | 2009 | 2008 | 2007 ...
Hi,
I've coded a bookmarklet that opens a new window at a certain URL and sends some variables to a PHP using GET.
The problem is I need to have it load the same php and send the same variables but inside a div this time.
Could anyone point me in the right direction please?
...