php - Call and exec function from class -


i have class , inside have function exec mysql query

$aupdateaulogs = dbc::$slave->selectassoc("insert auction_activity_logs (id_user, id_target)                                             values ('{$aauctiondata['_key_']}'),('{$aauctiondata['watched_auctions']}')"); return $aupdateaulogs ; 

so in file want call , exec after foreach

foreach ($aexpauction $nauctionid => $aauctiondata)  {     if (!array_key_exists($nauctionid, $awathedauctions))         continue; } 

first need include class want use. create class object. call function want created class object.

for instance,

i have class called testclass

//tetsclass.php <?php     class testclass{         public testfunction(){             //function codes simple return string.             return 'test output';         }     }  ?> 

after forloop

        require(tetsclass.php);     $testobj = new testclass();     $var = $testobj->testfunction();     echo $var;//it print text "test output" 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -