السلام عليكم و رحمة الله وبركاته
إخواني الكرام ما راح اطول عليكم كثيير لانه مشاغل الدنيا كثييرة مرة و انا شايف نفسي ما اجد حتي الوقت لاكل ههه
علي كل اعرض عليكم هالكلاس ( الي هو من برمجتي

)
ان شاء الله يفيدكم كثييير و ربح الكثيير من الوقت
وهو للتعامل مع جميييع انواع الاستعالمات من قواعد البيانات
( في هذا الكلاس عملت خاصية Seclect و خاصية جلب rows و سيتم اضافة بقية الخصائص بكرا ان شاء الله )
ملف interfaces.class.php
رمز PHP:
<code style="white-space:nowrap"> <code> Interface Option
{
public function SqlCde ($requete) ;
public function sqlQuery ($SqlSelec,$role,$sqlarray) ;
}
</code> </code>
رمز PHP:
<code style="white-space:nowrap"> <code> include ("interfaces.class.php") ;
Class EditClass implements ArrayAccess
{
Private $ficher ;
Private $valeur ;
Public $variable;
Public $check ;
public function offsetset($var,$valeur){
global $var ;
$this->var=$valeur;
}
public function offsetexists($name) {
Switch ("variable") {
case 'ficher' :
if (!file_exists($name)){
Global $check ;
$this->Check = FALSE ;
}
else { Global $check ;
$this->Check = TRUE ; }
case 'variable' :
if ( empty($name) and !isset ($name)) {
Global $check ;
$this->Check = FALSE ;
}
else { Global $check ;
$this->Check = TRUE ; }
}
}
public function offsetunset ($valeur){
unset ($valeur) ;
}
public function offsetget ($ficher){
return $this->ficher ;
}
}
Class ScriptOption extends EditClass implements option
{
Private $sqlarray;
Private $sqlcode ;
Private $role ;
Public $key ;
public function SqlCde ($sqlarray) {
$sqlcode = new ArrayIterator($sqlarray) ;
$sqlcode->ksort() ;
Global $key ;
foreach ( $sqlcode as $key=> $value ) {
define ( $key , $sqlcode[$key] ) ;
}
}
public function sqlQuery ($SqlSelec,$role,$sqlarray) {
$offsetexists = new EditClass() ;
$offsetexists->offsetexists($SqlSelec) ;
if ($offsetexists->Check) {
$this->mysql_query = mysql_query ($SqlSelec) ;
Switch ($role) {
case "fetch_row" :
global $value ;
$value = array() ;
while ( $rows = mysql_fetch_row($this->mysql_query)){
$sqlcode = new ArrayIterator($sqlarray) ;
$sqlcode->ksort() ;
foreach ( $sqlcode as $key=> $valeur ) {
array_push( $value , $rows[ $sqlcode[$key]] ) ;
}
}
}
}
}
}
$yo = new ScriptOption() ;
$yo->SqlCde (array ( "sql1"=>"select * from user",
"sql2"=>"select * from table ",
"sql2"=>"select * from name " ,
"sql2"=>"select * from user "
)) ;
### 6 and 4 the num of rows in array sql
$yo->sqlQuery( sql1 , "fetch_row" , array ( "lol"=>6 ,
"sql2"=>4
)) ;
echo $value[0] ; ##### get the rows 0 of array rows 6
</code> </code>
اخوكم Fahedouch
موفقين يا رب