This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
/** | |
* save json | |
* @param Array | $array | array | |
* @param String | $dir | dir location default: applcation/cache/ | |
* @return json | |
*/ | |
function save($array, $dir = NULL) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* why this variable $result? | |
*/ | |
$result = array(); | |
$rs = mysql_query("select * from dados where id=1"); | |
while($row = mysql_fetch_array($rs)) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* função para programador ir no supermercado | |
*/ | |
class SuperMercado | |
{ | |
private $leites; | |
private $ovos; | |
private $carrinho = array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Utilizando a função isset, perguntamos ao PHP se esta variavel realmente existe. | |
// http://br2.php.net/isset | |
if (isset($_POST['submit']) isset($_POST['name']) isset($_POST['email']) isset($_POST['message']) ) { | |
// É preciso apenas pegar os valores do POST após ter requisição. | |
$name = $_POST['name']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
else { | |
/** | |
* query | |
*/ | |
$ws_table_cg = $this->db->get('ws_cargos'); | |
$data = $ws_table_cg->result(); | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$data = strtotime('01/02/2014'); | |
$dataAtual = date('d/m/Y'); | |
/** | |
* Timespan | |
* | |
* Returns a span of seconds in this format: | |
* 10 days 14 hours 36 minutes 47 seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); | |
/** | |
* Smarty Class | |
* | |
* @package CodeIgniter | |
* @subpackage Libraries | |
* @category Smarty | |
* @author Kepler Gelotte | |
* @link http://www.coolphptools.com/codeigniter-smarty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Crie uma nova tabela `campos`. | |
- Nesta tabela, será responsável para armazenar todos os campos que serão pedidos ao inserir um novo animal. | |
- Estrutura da tabela: | |
`id` (auto_increment) | |
`id_grupo` ( se você tem algum controle de grupos, por exemplo (peixe = 3) você pode especificar que esses campos só serão usados quando for inserir novo tipo de especie de peixe) | |
`access` ( se você tiver niveis de permissão use este campo para definir que nível terá acesso a este campo, por exemplo: Admin pode adicionar o peso do peixe, mas um funcionário só poderá adicionar o nome e especie, já que ele terá nível de permissão menor do que estara definido aqui. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Verficando se foi acionado o envio do formulário. | |
if(isset($_POST['submit'])) | |
{ | |
$login_digitado = $_POST['login']; | |
$senha = $_POST['senha']; | |
$nome = $_POST['nome']; | |
$email = $_POST['email']; | |
$telefone = $_POST['telefone']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert the entire $object->all array result set into an array of | |
* associative arrays. | |
* @see to_array | |
* @param DataMapper $object The DataMapper Object to convert | |
* @param array $fields Array of fields to include. If empty, includes all database columns. | |
* @param string $key_field Key Field array | |
* @return array An array of associative arrays. | |
*/ | |
function all_to_array($object, $fields = '', $key_field = '') |
OlderNewer