₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,326,512 members, 8,426,886 topics. Date: Monday, 15 June 2026 at 06:11 AM

Toggle theme

PHP Workouts-sqlite3 CLASSES (wrapping Or Extending) - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingPHP Workouts-sqlite3 CLASSES (wrapping Or Extending) (1316 Views)

1 Reply

PHP Workouts-sqlite3 CLASSES (wrapping Or Extending) by Kidstell(op): 12:13pm On Aug 27, 2013
These are ways of utilizing the sqlite3 class. Which will you choose and why or better still which of these is the BEST

method 1 extending
<?php class MyDB extends SQLite3{
function __construct(){ $this->open('test.db');}
}
$db =new MyDB();
if(!$db){
echo $db->lastErrorMsg();
}else{
echo "Opened database successfully\n";
}
?>

method 2 wrapping
class MyDb {
function __construct(){
$data=new sqlite3();
$data->open('test.db');}
}
$db =new MyDB();
if(!$db){
echo $db->lastErrorMsg();
}else{
echo "Opened database successfully\n";
}
?>
Re: PHP Workouts-sqlite3 CLASSES (wrapping Or Extending) by Kidstell(op): 5:29pm On Sep 03, 2013
I used to think we 've got sure ethical programmers here. Why is nobody talking, there are no rules here.
Well i will really like to use the Extend because it gives of access to predefined functions and i won't need to re-invent any wheel. Also i 'll be able to create functions that call the predefined functions without creating a new object instance of the sqlite3 class, this helps save ram space. Lets talk
1 Reply

[MOD] PHP WORKOUTS - String Manipulation 1[MOD] PHP Workouts-email Validation In Php Using Any Method.Abstract, Interface And Adapter Classes234

App That Calculates GP, Matrix, Quadratic And Simultenous EqsSchool Management Software For Your Growing SchoolIn Need Of A Programmer