Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    [Principiante] Non riesco a trovare dove sbaglio -

    Sono arrugginito ma non capisco cosa non funge
    In pratica vorrei che quando CAMPO3 ha un valore = CONDIZIONE lo sfondo della cella che contiene il suo output cambi da rosso a verde

    Codice PHP:
    <?
    $connect 
    odbc_connect("DatabaseODBC","user","psw");
    if (!
    $connect){exit("Error");} 
    $sql "select * from vista where CAMPO = 'CONDIZIONE'";
    $essequelle odbc_exec($connect,$sql);
    if (!
    $essequelle)
     {exit(
    "Error");}

    echo  
    "<table border = '5'><tr>";
    echo  
    "<th>CAMPO1</th>";
    echo  
    "<th>CAMPO2</th>";
    echo  
    "<th>CAMPO3</th>";
    echo  
    "<th>CAMPO4</th>";
    $PCONV "FF0033";

    while(
    odbc_fetch_row($essequelle))
           {
    $CAMPO1=  odbc_result($essequelle,"CAMPO1");
    $CAMPO2=  odbc_result($essequelle,"CAMPO2");
    $CAMPO3=  odbc_result($essequelle,"CAMPO3");
    $CAMPO4=  odbc_result($essequelle,"CAMPO4");
    if (
    $CAMPO3="CONDIZIONE"$PCONV = ("66FF00");
    echo 
    "<tr><td>$CAMPO1</td>";
    echo 
    "<td>$CAMPO2</td>";
    echo 
    "<td BGCOLOR=$PCONV>$CAMPO3</td>";
    echo 
    "<td>$CAMPO4</td><tr>";

     }
    odbc_close($connect);
    echo 
    "</table>";
    ?>

  2. #2
    Utente di HTML.it L'avatar di boots
    Registrato dal
    Oct 2012
    Messaggi
    1,626
    if ($CAMPO3="CONDIZIONE")

    ci va ==, senza contare che dovresti "resettare" $PCONV, altrimenti una volta che viene soddisfatta la condizione la variabile varrà sempre 66FF00
    Ultima modifica di boots; 28-12-2013 a 13:43

  3. #3
    Quote Originariamente inviata da boots Visualizza il messaggio
    if ($CAMPO3="CONDIZIONE")

    ci va ==, senza contare che dovresti "resettare" $PCONV, altrimenti una volta che viene soddisfatta la condizione la variabile varrà sempre 66FF00
    che pollo che sono
    grazie mille
    meglio che vado a pitturare le striscie in autostrada
    ciao
    Ivan

  4. #4
    Quote Originariamente inviata da Tienanmen Visualizza il messaggio
    che pollo che sono
    grazie mille
    meglio che vado a pitturare le striscie in autostrada
    ciao
    Ivan
    a pitturare le strisce in autostrada??? spettacolare!
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

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.