mercredi 6 juillet 2016
PHP/MYSQLi/OOP public, protected, private function
I have created a public function (hoping that is the right one), I'm not really sure of the benefits and limitations, or best uses of each but...
I need to run a function that will run for any person who accesses a certain page. The page is returning staff members and I want to display their title.
public function getTitle( $id ) {
global $params, $db;
$db->query( "SELECT * FROM users WHERE `id` = '{$id}'" );
$db->assoc( $coreQuery );
return $this->data['title'];
return true;
}
Previous code:
public function getTitle( $id ) {
global $params, $db;
$coreQuery = $db->query( "SELECT * FROM users WHERE `id` = '{$id}'" );
$coreArray = $db->assoc( $coreQuery );
$return = $coreArray['title'];
return $return;
}
I have used the above function but this is not returning anything in the echo.
Have I done this wrong?
Any help would be appreciated.
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire