MySQL can be used to do some string replacements rather using any programming languages.
The following is used to replace space with hyphen in list names
UPDATE list SET list_name = REPLACE(list_name, ' ', '-') WHERE list_name LIKE '% %';
User registration form is a good example for this validator. Checking the username exists or not.
Db_NoRecordExists validator helps to achieve this
$username = new Zend_Form_Element_Text('username', array('label' => 'Username', 'required' => true, 'filters' => array('StripTags', 'StringTrim'), 'validators' => array('NotEmpty', array('Db_NoRecordExists',false,array( 'users_table','username_column', 'messages' => array( Zend_Validate_Db_Abstract::ERROR_RECORD_FOUND => '%value% already exists') )))));
If your Putty Connection Manager doesn't load Putty inside the Manager then do this :
1. Go to View -> Connection Manager
2. Right Click in side the right panel -> create a Database ( give any name )
That will create SSH and Telnet folders
3. Right Click on SSH folder and then New -> Connection Manager
4. Add Host Name and select SSH protocol
5. File -> Save All Databases
You are done now.
System commands can be executed from PHP using exec command.
eg:
$out = array(); $command = "memcat --server=10.10.10.10 ITEMS > /tmp/items.txt";The $out variable would hold the output of the command. If there is any issue with executing a command , have the command with path.
exec($command, $out);
eg: $command = "/usr/local/bin/memcat --server=10.10.10.10 ITEMS > /tmp/items.txt";for further info: http://www.php.net/manual/en/function.exec.php
exec($command, $out);
Like keyword can be used with Zend_Db select query
$query = $this->select()
->where("firstname like ?", $letter."%");
try that works.
There is a way to select comma separated data from any mysql table.
SELECT poll_id,group_concat(option_id) FROM `poll_elements`
group by poll_id
this will output as follows:
poll_id | group_concat(option_id)
1 | 3855,5098,8474
3 | 3855,9469,15677
6 | 509,3855,9469,10489