accessing objects, static variables in PHP
<p>Here's my code:</p>

<pre><code>class Photograph extends DatabaseObject {

    protected static $table_name="photographs";
    protected static $db_fields=array('id', 'filename', 'type', 'size', 'caption','album_id');
    public $id;
    public $filename;
    public $type;
    public $size;
    public $caption;
    //public $album_id;
    protected static $album_id;

    private $temp_path;
    protected $upload_dir="images";
</code></pre>

<p>Now, when I use this function below on another page like '$photos = Photograph::find_by_album();' </p>

<p>I get an sql error that says: 'Database query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=' at line 1'</p>

<pre><code>public static function find_by_album($album_id='') 
{
return self::find_by_sql("SELECT * FROM ".self::$table_name."WHERE album_id = ".self::$album_id."");
}
</code></pre>

<p>Basically, what I would to happen is to get all values saved in the database from the $table_name where $album_id entered by the user is equivalent to the album_id found in the database. You may find this problem simple, but unfortunately, I am not able to find a solution. Any ideas please? Thanks in advance. :) </p>

<p>EDIT:</p>

<p>Following Mr. Elias Ootegem,</p>

<p>I have modified the code and it now looks like </p>

<pre><code>public static function find_by_album($album_id='') 
{ return self::find_by_sql("SELECT * FROM ".self::$table_name." WHERE album_id = ".$album_id.""); 
}
</code></pre>

<p>However, I still get the same error. I tried using this code: </p>

<pre><code>public static function find_by_album() 
{ return self::find_by_sql("SELECT * FROM ".self::$table_name." WHERE album_id = ".$album_id.""); 
} 
</code></pre>

<p>Now another error comes up which says: Undefined variable: album_id </p>

<p>Any other ideas?</p>
