Pagina 3 di 3 primaprima 1 2 3
Visualizzazione dei risultati da 21 a 25 su 25

Discussione: ciclo while

  1. #21
    Codice PHP:
    <?php    do {             
    echo 
    $row_DetailRS1['Portata'];  
    echo 
    "<input type=\"checkbox\" name=\"Maychek\"id=\"Maychek\" /> 
    <label for=\"Maychek\"> </label>"
    ;          
    }           
     while (
    $row_DetailRS1 mysql_fetch_assoc($DetailRS1));  ?>        
    </form>
    così mi estrae i dati dal db ma mi da sempre e solo una check qualche ida?

  2. #22
    Moderatore di PHP L'avatar di Alhazred
    Registrato dal
    Oct 2003
    Messaggi
    12,509
    Ovvio che ti stampa una sola check, la tua query è
    SELECT * FROM prodotti WHERE ID = ...

    Ora, quanti elementi ci saranno con quell'id? Essendo l'id univoco... direi 1 quindi hai solo un elemento da stampare.

  3. #23
    azzzz.......spita

  4. #24
    Codice PHP:
    <?php require_once('../../Connections/pastauovo.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function 
    GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
    {
      if (
    PHP_VERSION 6) {
        
    $theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }

      
    $theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

      switch (
    $theType) {
        case 
    "text":
          
    $theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
          break;    
        case 
    "long":
        case 
    "int":
          
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case 
    "double":
          
    $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case 
    "date":
          
    $theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
          break;
        case 
    "defined":
          
    $theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
          break;
      }
      return 
    $theValue;
    }
    }

    $colname_DetailRS1 "-1";
    if (isset(
    $_GET['recordID'])) {
      
    $colname_DetailRS1 $_GET['recordID'];
    }
    mysql_select_db($database_pastauovo$pastauovo);
    $query_DetailRS1 sprintf("SELECT * FROM preventivi WHERE ID = %s"GetSQLValueString($colname_DetailRS1"int"));
    $DetailRS1 mysql_query($query_DetailRS1$pastauovo) or die(mysql_error());
    $row_DetailRS1 mysql_fetch_assoc($DetailRS1);
    $totalRows_DetailRS1 mysql_num_rows($DetailRS1);
    ?>


    <form id="form2" name="form2" method="post" action="">
     <?php  while ($row_DetailRS1 mysql_fetch_assoc($DetailRS1));
           { 
      echo 
    $row_DetailRS1['Aperitivi']; 
      echo 
    "<input type=\"checkbox\" name=\"Maychek\"id=\"Maychek\" /> <label for=\"Maychek\"></label>"
              
              } 
    ?>
          </form>
    ho creato una tabella nel tatabase ho assegnato id 1 a tutti gli aperitivi
    ho ricreato la query
    ma il risultato non cambia vedo i prodotti ma non le check

  5. #25
    avete chiuso il post?

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 © 2026 vBulletin Solutions, Inc. All rights reserved.