View Single Post
ישן 12-08-07, 17:02   # 7
Elad-A
הוסטסניון
 
מיני פרופיל
תאריך הצטרפות: May 2006
הודעות: 1,987

Elad-A לא מחובר  

אממ קח מחלקה שפעם השתמשתי בה:

PHP קוד:
<?php

$db 
= new mysql;

class 
mysql 

    function 
Connect($host$name$pass$db)
    { 
        
$connection mysql_connect($host$name$pass); 
          
mysql_select_db($db$connection); 
    }
 
    function 
FetchRow($query)
    { 
        
$rows mysql_fetch_row($query); 
        return 
$rows
    } 
    function 
FetchArray($query)
    { 
        
$array mysql_fetch_array($query); 
        return 
$array
      } 

    function 
FetchNum($query)
    { 
        
$num mysql_num_rows($query); 
        return 
$num
    } 
  
    function 
Query($sql)
      { 
          
$query mysql_query($sql) or die(mysql_error()); 
          return 
$query
    }
}

?>
בקובץ global.php שלך תשים ככה:

PHP קוד:

// the user name of the mysql data base
$DataBase['user'] = "root";

// the password of the mysql data base
$DataBase['pass'] = "";

// the name of the mysql data base
$DataBase['name'] = "xyz";

// the host of the mysql data base, default: "localhost"
$DataBase['host'] = "localhost";

$DB->Connect($DataBase['host'], $DataBase['user'], $DataBase['pass'], $DataBase['name']); 
ככה זה יחסוך לך התחברות למסד כל פעם, אני מאמין שמפה אתה תסתדר כבר..
  Reply With Quote