הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

השב
 
כלים לאשכול תצורת הצגה
ישן 18-07-07, 23:02   # 1
Eran-s
הוסטסניון
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
הודעות: 2,609

Eran-s לא מחובר  

תביא את המחלקה כי אני לא ממש בטוח שהבנתי אותך
__________________
מפתח ומתחזק אתרים.
  Reply With Quote
ישן 18-07-07, 23:41   # 2
phpyo
חבר בקהילה
 
מיני פרופיל
תאריך הצטרפות: Jan 2007
הודעות: 180

phpyo לא מחובר  

PHP קוד:
<?php

/***************************************************************

    Name : classes.php
    Description: Includes several important classes
    
***************************************************************/

    
include("constants.php");


/*****************************************************************

|+| name { class sql }
|+| the sql class is about to handle details that have connected to sql

******************************************************************/
    
    
class sql
    
{

        var 
$sql_function;    // 'INSERT','SELECT....
        
var $args;        // db details or table names
        
var $addition;        // 'WHERE'.....


        
function sql($sql_function,$args,$addition)
        {
            
$this->sql_function $sql_function;
            
$this->args        $args;
            
$this->addition        $addition;
        }
        
            
//The following function is a typical mysql db connection

        
function connect()
        {
            
$db_d      explode(",",$this->args);
            
$server  $db_d[0];
            
$username$db_d[1];
            
$password$db_d[2];
            
$db_name $db_d[3];

            
mysql_connect($server,$username,$password);
            
mysql_select_db($db_name);
                
        }
        

        function 
sql_ord()
        {

            
$query mysql_query($this->sql_function) or die(mysql_error());            
            
        }
            
            
        
    }


    
$connect = new sql("","localhost,root,,bla","");
    
$connect->connect();

    
$sql "INSERT INTO `".MAIN_TABLE."` VALUES('a','b','c') ";
    
$insert  = new sql($sql,"","");
    
$insert->sql_ord();

?>

הנה המחלקה.
המופע הראשון מבצע את ההתחברות למסד.
אשמח גם לקבל טיפים לשיפור בכלליות.

תודה!!!
  Reply With Quote
השב

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 01:25.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ