At times on a shared host you may not be able to use a symbolic link. I sometimes just display from a folder outside of web folder:
<?php
$basedir = '/some_folder/images'; // on hard drive
$imagedir = $_GET['dir'];
$image = $_GET['img'];
$("#myTable td:nth-child(1)").click(function(event) | |
{ | |
event.preventDefault(); | |
var $td= $(this).closest('tr').children('td'); | |
var currentCellText = $td.eq(0).text(); | |
var CellText = $td.eq(1).text(); | |
$.ajax({ | |
url:'<?php echo "getowner";?>', | |
type: 'GET', | |
data: 'id='+currentCellText, |
/////////controller | |
public function getowner() { | |
$id = $_GET['id']; | |
$data = $this->Powners->get($id); | |
$petowner = $data->oname; | |
$ostreet = $data->ostreet; | |
$retvalue = $petowner . "|" . $ostreet; |
namespace App\Model\Entity; | |
use Cake\ORM\Entity; | |
class Article extends Entity | |
{ | |
protected function _getTitle($title) | |
{ | |
return ucwords($title); | |
} |
public function getowner() { | |
$id = $_GET['id']; | |
$data = $this->Powners->get($id); | |
echo json_encode($data); | |
} |
// In an update method
public function add()
{
// Validate as needed
$lid=DB::table('dc_dogs')->count();
$lid=$lid+1;
$file=Request::file('ufile');
$file_name=$file->getClientOriginalName();
$file_ext=$file->getClientOriginalExtension();
entity code: | |
<?php | |
namespace App\Model\Entity; | |
use Cake\ORM\Entity; | |
use Cake\Utility\Inflector; | |
/** | |
* Pet Entity. | |
*/ |
On a PHP coding forum someone ask how to loop a certain array. | |
The data was in Json format (not shown), but this will give a good idea of how to handle looping an array. | |
I just named the Json data $mydata. | |
First json decode it: | |
``` | |
$decoded = json_decode($mydata, true); | |
// I just put the json in the variable $mydata to work with. |
<?php | |
/* | |
PHP/MySQL (PDO) method with named parameters | |
--------------------------------------------- | |
https://gist.github.com/luckyshot/9477105 | |
Last updated: 12 Sep 17 | |
$config = [ |