Can't select images from database? (PHP) -


i never bofore used oop in php, in c#,c++ etc want make 1 website use oop.

i want select photos slike table, , show in index page.

this engine.php file select() function works good, select_slike() not select anything. can explain me please, error? thank you.

<?php error_reporting(e_all); ini_set('display_errors', '0'); include("connect.php"); class manage{     public function select(){         $query = mysql_query("select naslov slike");         if($query)         {             while($row=mysql_fetch_array($query)){                 echo '<option value="'.$row['slike_id'].'">'.$row['naslov'].'</option>';             }         }         else{             die(mysql_error());         }     }     public function select_slike(){         $query = mysql_query("select * slike");         if($query)         {                while($row = mysql_fetch_array($query)){             echo '<img src="../images/'.$row['string'].'.jpg'.'"/>';             }         }         else{             echo mysql_query();         }     } } ?> 

index.php page

<center> <?php $m = manage; $m->select_slike(); ?> </center> 

create new instance calling

$m = new manage(); 

and can call

$m->select_slike(); 

the way put it, i'm not sure if you'd have static method. if want static (class) method, can declare this

public static function select_slike() 

and can do

manage::select_slike(); 

you can find out more in php manual @ http://php.net/manual/en/language.oop5.php it's explained in detail


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -