Visualizzazione dei risultati da 1 a 3 su 3

Discussione: assegnare Id

  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2006
    Messaggi
    77

    assegnare Id

    Buongiorno, mi volevo scusare con tutti per il post precedente con richiesta aiuto,ma non avevo letto il regolamento,speriamo adesso di non ricascarci .
    Sto realizzando un programma per la gestione delle camere di un'agriturismo ( 5 camere).
    Ho creato 2 database uno camere (id,camera,stato) e l'altro dati cliente.
    Ogni id della tabella camere mi rappresente il numero delle camere quindi mi sono generato una tabella con solo 5 record. Ho fatto un form e dentro ho messo una tabella 2 righe e 5 colonne dove ad ogni casella vorrei assegnare una camera,inoltre mi assume due immagini a seconda del valore che assume il campo stato Y o N.
    E' possibile assegnare ad ogni casella un'Id (della tabella camere)?oppure mi devo creare 5 tabelle una per ogni camera e di consegueza 5 recordset?


    Spero di essere stato chiaro
    grazie e ciao a tutti

    <?php require_once('Connections/programma.php'); ?>
    <?php
    mysql_select_db($database_programma, $programma);
    $query_Recordset1 = "SELECT * FROM camere";
    $Recordset1 = mysql_query($query_Recordset1, $programma) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Documento senza titolo</title>
    </head>

    <body>


    </p>
    <form id="form1" name="form1" method="post" action="">
    <table width="323" height="127" border="1">
    <tr>
    <td width="100"><?php if (stato==y) { echo "<img src=\"libero.jpg\"width=\"40\" height=\"40\"/>";
    }
    else { echo "<img src =\"occup.jpg\"width=\"40\" height=\"40\"/>";
    }
    ?>
    <?php echo $row_Recordset1['id']; ?></td>
    <td width="38"></td>
    <td width="39"></td>
    <td width="42"></td>
    <td width="70"></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    </table>


    </p>


    </p>
    </form>


    </p>
    </body>
    </html>
    <?php
    mysql_free_result($Recordset1);
    ?>

  2. #2
    Non l'ho testato... Prova!!

    <?php
    require_once('Connections/programma.php');
    mysql_select_db($database_programma, $programma);
    $query_Recordset1 = "SELECT * FROM camere";
    $Recordset1 = mysql_query($query_Recordset1, $programma) or die(mysql_error());

    for($i=0;$i<=4;$i++){
    if(mysql_result($Recordset1,0,stato)=="y"){
    $img[$i]="[img]libero.jpg[/img]";
    }else{
    $img[$i]="[img]ocupp.jpg[/img]";
    }

    $id[$i]=mysql_result($Recordset1,$i,id);
    }
    ?>

    <form id="form1" name="form1" method="post" action="">
    <table border="1" width="323" height="127">
    <tr>
    <td width="20%"><?echo $img[0];?></td>
    <td width="20%"><?echo $img[1];?></td>
    <td width="20%"><?echo $img[2];?></td>
    <td width="20%"><?echo $img[3];?></td>
    <td width="20%"><?echo $img[4];?></td>
    </tr>
    <tr>
    <td width="20%"><?echo $id[0];?></td>
    <td width="20%"><?echo $id[1];?></td>
    <td width="20%"><?echo $id[2];?></td>
    <td width="20%"><?echo $id[3];?></td>
    <td width="20%"><?echo $id[4];?></td>
    </tr>
    </table>
    </form>


    Ciaooo!!!


  3. #3
    Utente di HTML.it
    Registrato dal
    Mar 2006
    Messaggi
    77
    grazie

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.