|  | 
  Nick Wilkinson - 2008-03-12 03:09:05Copied the ExampleObject.php and made some changes, now is:
 <?php
 class Property extends BaseObject {
 public function GetTableName() {
 return 'properties';
 }
 public function IdField() {
 return 'iden_id';
 }
 public static function &ById($id) {
 self::GetById($id);
 }
 }
 ?>
 
 Then trying to use it with:
 
 <?php
 require_once 'Mysql.php';
 require_once 'BaseObject.php';
 require_once '_Property.php';
 Mysql::Init('localhost', 'user', 'pass', 'database');
 $this_property = Property::ById(484);
 echo $this_property->data_name;
 echo $this_property->phot_photos;
 ?>
 
 And nothing comes out with the two echo statements. I've tried messing up the "return 'iden_id';" from the parent object to a non-existent field in my table, and that returns an error, but with the correct field name mapped to id, I get no data from $this_property->some_field.
 
 Any suggestions, or another example that is working?
 
 Thanks!
 
 
 
  Indrek Altpere - 2008-03-12 07:52:53 - In reply to message 1 from Nick WilkinsonWhat is your table structure ? Perhaps you could send it to me if it's just some testing table. Are you sure connection properties are correct ?
 To put mysql into query debug mode, after Mysql::Init(); put Mysql::SetDebug(true);
 and in the end of script do
 echo Mysql::ToString();
 
 That should give out some infotmation about mysql commands processed.
 
 I myself am using it in literally tens of projects, some created by me, in others it is just a coding speedup. Instead of building large queries, I just set object properties and call save function and everytime only actually changed data is sent to database.
  Indrek Altpere - 2008-03-12 07:52:55 - In reply to message 1 from Nick WilkinsonWhat is your table structure ? Perhaps you could send it to me if it's just some testing table. Are you sure connection properties are correct ?
 To put mysql into query debug mode, after Mysql::Init(); put Mysql::SetDebug(true);
 and in the end of script do
 echo Mysql::ToString();
 
 That should give out some infotmation about mysql commands processed.
 
 I myself am using it in literally tens of projects, some created by me, in others it is just a coding speedup. Instead of building large queries, I just set object properties and call save function and everytime only actually changed data is sent to database.
  Indrek Altpere - 2016-06-18 15:20:46 - In reply to message 1 from Nick WilkinsonThe ById function contents should look like this:return self::GetById($id, __CLASS__);
 |