לוגו אתר Fresh          
 
 
  אפשרות תפריט  ראשי     אפשרות תפריט  צ'אט     אפשרות תפריט  מבזקים     אפשרות תפריט  צור קשר     חץ שמאלה ‎print ‎"Hello World!"; if‎ ‎not rules.‎know ‎then rules.‎read(); חץ ימינה  

לך אחורה   לובי הפורומים > מחשבים > תכנות ובניית אתרים
שמור לעצמך קישור לדף זה באתרי שמירת קישורים חברתיים
תגובה
 
כלי אשכול חפש באשכול זה



  #1  
ישן 26-07-2006, 15:14
צלמית המשתמש של tnadav1
  משתמש זכר tnadav1 tnadav1 אינו מחובר  
 
חבר מתאריך: 02.10.05
הודעות: 2,355
שלח הודעה דרך MSN אל tnadav1
בעיה בעברית ומסדי נתונים (קצת שונה)

אוקי.. כדי שתבינו על מה אני מדבר.. הנה המחלקה שאני משתמש בה (שאני פיתחתי.. מן הסתם):
קוד PHP:
<?php
class movieSYS
{
    var 
$insertQuery;
    var 
$sqlList;
    var 
$notOnC;
    var 
$notOnS;
    var 
$cList;
    var 
$pList;
    var 
$sqlLocArray;
    function 
movieSYS()
    {
        
//wellcome to the main function
        //scan Parents dir
        
$this->pList=$this->scanSYS('//Parents/Downloads');
        
//sacn self dir
        
$this->cList=$this->scanSYS('D:/movies');
        
//now we select movies from the DataBase
        
$this->sqlList=mysql_query("SELECT `nameEng`, `nameHeb`, `id`, `loc` FROM `movies_dirs`");
        
//make an array of all the 'loc' value
        
$i=1;
        while(
$info=mysql_fetch_array($this->sqlList))
        {
            
//print only for check
            
echo $info['loc']."<br />\n";
            
$this->sqlLocArray[$i] = $info['loc'];
            
$i++;
        }
        
//again we are checking
        
var_dump($this->sqlLocArray);
        
//we only print the query for checking
        
echo nl2br($this->makeInsert($this->cList$this->pList));
    }
    function 
scanSYS($dir)
    {
        
//this function is get a list of dirs in a dir
        
$val NULL;
        
//create an array and make a list of dirs
        
foreach(glob($dir.'/*') as $file)
            {
            if(
is_dir($file))
                            
$val .= str_replace($dir.'/'''$file)."\n";
            }
            return 
$val;
    }
    function 
makeInsert()
    {
        
//this function is "the" function, we make the insert query
        //the start of the query is constent.. so we make it...
        
$this->insertQuery 'INSERT INTO `movies_dirs` (`loc`, `com`, `new`) VALUES';
        
//open the list...
        
$cLista explode("\n"$this->cList);
        
$pLista explode("\n"$this->pList);
        
//we make the insert and filtering the unwanted 
        
foreach ($cLista as $file)
        {
            if(empty(
$file)) //unwanted!
                
continue;
            if(
in_array($file$this->sqlLocArray)) //unwanted!
                
continue;
            @
preg_replace("/([\xE0-\xFA])/e","chr(215).chr(ord(\${1})-80)"$file); //convert to unicode
            
$this->insertQuery .= "\n('".$file."', 'Children', 1), "//and here is part of the query!
        
}
        
//same thing with different array
        
foreach ($pLista as $file)
        {
            if(empty(
$file))
                continue;
            
$file=str_replace('?''', @preg_replace("/([\xE0-\xFA])/e","chr(215).chr(ord(\${1})-80)"$file));
            
$this->insertQuery .= "\n('".$file."', 'Parents', 1), ";
        }
        
//fix a problem with the query
        
$this->insertQuery{strrpos($this->insertQuery',')} = '';
        return 
$this->insertQuery;
    }
}
$link=mysql_connect('localhost''root''070794');
mysql_query("SET NAMES utf8");
mysql_select_db('movies');
$mov = new movieSYS();
?>


אוקי.. הכל עובד פה מצוין.. חוץ מהסינון בקטע:
קוד PHP:
 if(in_array($file$this->sqlLocArray)) //unwanted!
continue; 

זה מסנן, אבל כשיש רשומות שבעמודה loc שלהם יש עיברית, זה לא מסנן...

יש פיתרון?
_____________________________________


תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
תגובה

כלי אשכול חפש באשכול זה
חפש באשכול זה:

חיפוש מתקדם
מצבי תצוגה דרג אשכול זה
דרג אשכול זה:

מזער את תיבת המידע אפשרויות משלוח הודעות
אתה לא יכול לפתוח אשכולות חדשים
אתה לא יכול להגיב לאשכולות
אתה לא יכול לצרף קבצים
אתה לא יכול לערוך את ההודעות שלך

קוד vB פעיל
קוד [IMG] פעיל
קוד HTML כבוי
מעבר לפורום



כל הזמנים המוצגים בדף זה הם לפי איזור זמן GMT +2. השעה כעת היא 15:34

הדף נוצר ב 0.04 שניות עם 12 שאילתות

הפורום מבוסס על vBulletin, גירסא 3.0.6
כל הזכויות לתוכנת הפורומים שמורות © 2024 - 2000 לחברת Jelsoft Enterprises.
כל הזכויות שמורות ל Fresh.co.il ©

צור קשר | תקנון האתר