Visualizzazione dei risultati da 1 a 3 su 3

Discussione: php mysql flash!!

  1. #1
    Utente di HTML.it
    Registrato dal
    Dec 2003
    Messaggi
    28

    php mysql flash!!

    Cari tutti,

    sto cercando di fare parlare un db mysql con uno scroll per news in flash. Utilizzo per questo uno script PHP e credo sia corretto.
    Solo che non riesco assolutamente (mentre tutto funziona se a essere richiamato è un .txt)


    questo lo script php per estrarre i valori da mysql:

    <?php
    $host = 'host'; # l'host in cui risiede il database (IP)
    $user = 'user'; # la username per accedere al database
    $pass = 'pass'; # la password per accedere al database
    $db = 'db'; # il nome del database

    mysql_connect($host,$user,$pass); #connessione al database
    mysql_select_db($db); #selezione al database

    $tot = 5; # il numero di news da visualizzare ogni volta
    $i = 0; # variabile che serve da indice (da incrementare)
    $query = "SELECT id,titolo,testo,DATE_FORMAT(data, '%d.%m.%Y') as newData
    FROM news
    ORDER by data desc
    LIMIT 0,$tot";
    $result = mysql_query($query);
    $output = 'tot='.mysql_num_rows($result);
    while($news = mysql_fetch_array($result))
    {
    $output .= '&data'.$i.'='.$news['newData'];
    $output .= '&id'.$i.'='.$news['id'];
    $output .='&Title'.$i.'='.urlencode($news['titolo']);
    $output .='&myText'.$i.'='.urlencode(substr($news['testo'],0,200));
    $i++;
    }
    echo $output;
    ?>


    quindi il file flash che ha due livelli. Questo il codice nel primo livello:

    // Creo un nuovo LoadVars Object
    myData = new LoadVars();

    // questo dice che funzione invocare quando la Load Vars è completa.

    myData.onLoad = addItems;

    // questo è il collegamento al file php.
    myData.load("news.php");


    questo il codice nel secondo livello:

    function addItems() {

    // Seleziono il titolo dal file php.
    Title = myData.Title;

    // Seleziono alcune proprietà.
    myText.multiline = true;
    myText.wordWrap = true;
    myText.type = "dynamic";
    myText.background = true;
    myText.backgroundColor = "0x000000";
    myText.border = false;
    myText.html = true; // Enables HTML in the text field.

    // Setto il testo per il campo testo.
    myText.htmlText = myData.myText;
    ScrollBar.setScrollTarget(myText);

    // applico uno stile allo scroll.
    formStyleFormat = new FStyleFormat;

    formStyleFormat.scrollTrack = "0x000000";
    formStyleFormat.highlight = "0x000000";
    formStyleFormat.highlight3D = "0xffffff";
    formStyleFormat.arrow = "0xffffff";
    formStyleFormat.face = "0x000000";
    formStyleFormat.background = "0x000000";
    formStyleFormat.shadow = "0x666666";
    formStyleFormat.darkshadow = "0x333333";

    // Applico i cambiamenti.
    formStyleFormat.addListener(ScrollBar);
    formStyleFormat.applyChanges();

    // Setto alcune altre opzioni
    textFormat = new TextFormat();
    textFormat.color = "0xffffff";
    textFormat.bullet = false;
    textFormat.underline = false;
    textFormat.bullet = false;
    textFormat.size = 11;
    textFormat.font = "arial";

    // Setto il formato testo
    myText.setTextFormat(textFormat);
    }

    Questo è quanto...
    Qualcuno sa come farlo funzionare?
    vi ringrazio in anticipo!

  2. #2
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Cosa stampa la pagina php nel browser?

  3. #3
    $output = 'tot='.mysql_num_rows($result);

    cambialo con

    $output = '&tot='.mysql_num_rows($result);



    poi ....



    Title = myData.Title;

    1 - cos'e' Title ??? ... se e' un nome di istanza, come dovrebbe essrere sara' Title.text o Title.htmlText = myData.Title

    2 - myData.Title non esiste, casomai esiste myData['Title0']
    Formaldehyde a new Ajax PHP Zero Config Error Debugger

    WebReflection @WebReflection

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.