Pagina 2 di 3 primaprima 1 2 3 ultimoultimo
Visualizzazione dei risultati da 11 a 20 su 25

Discussione: ciclo while

  1. #11
    Eccoci:
    Grazie per il vostro aiuto.

    Codice 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 prodotti 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); 

  2. #12
    Scusami ma non riesco a leggere il codice così, mettilo per esteso non su una sola riga
    Programmatore e responsabile seo della testata giornalistica www.europacalcio.it - www.canforagennaro.it

  3. #13
    Codice 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 prodotti 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); 
    forse così lo leggi meglio

  4. #14
    metti modifica, al tuo post e scrivici anche il codice con il while e la checkbox
    Programmatore e responsabile seo della testata giornalistica www.europacalcio.it - www.canforagennaro.it

  5. #15

    Modifica

    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 prodotti 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);
      
    ?>
    <!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=windows-1252" />
    <title>Area riservata Prodotti Bottega della pasta all'uovo</title>
    <link rel="stylesheet" type="text/css" href="../style.css" />
    <script type="text/javascript" src="../unitpngfix.js"></script>
    </head>
    <body>
    <div id="main_container">
      <div class="top_leafs">[img]../images/top_leafs.png[/img]</div>
      <div id="header">
        <div class="logo"> [url="../index.php"]La Bottega della Pasta all'Uovo[/url] </div>
        <div class="menu">
          <ul>
            <li class="selected">[url="#"]home[/url][*][url="#"]Cosa dicono di noi[/url][*][url="#"]Preventivi[/url][*][url="#"]Contatti[/url][/list]
        </div>
      </div>
      <div id="center_content">
        <div class="left_content">
          

    [img]../images/img_portate/<?php echo $row_DetailRS1['Img']; ?>[/img]</p>
          <h1><?php echo $row_DetailRS1['TIpo_portata']; ?></h1>
          <form id="form2" name="form2" method="post" action="">
            <?php  
    while ($row_DetailRS1 mysql_fetch_assoc($DetailRS1)); 
    {           
      echo 
    $row_DetailRS1['Portata']; 
      print 
    "<input type=\"checkbox\" name=\"Maychek\"id=\"Maychek\" /> <label for=\"Maychek\"></label>";          
    }           
    ?>
          </form>
          <h1></h1>
          <h1>Prodotti</h1>
          <div class="photos_block">
            <div class="photo_box"> [url="prodotti_log.php?recordID=1<?php echo @$row_Rs_portate['ID']; ?>"][img]../images/aperitivi.jpg[/img][/url]

              [url="prodotti_log.php?recordID=1<?php echo @$row_Rs_portate['ID']; ?>"]Aperitivi[/url] </div>
            <div class="photo_box"> [url="prodotti_log.php?recordID=5<?php echo @$row_Rs_portate['ID']; ?>"][img]../images/Primi_piatti.jpg[/img][/url]

              [url="prodotti_log.php?recordID=5<?php echo @$row_Rs_portate['ID']; ?>"]Antipasti di Carne[/url] </div>
            <div class="photo_box"> [url="prodotti_log.php?recordID=3<?php echo @$row_Rs_portate['ID']; ?>"][img]../images/antipasti.jpg[/img][/url]

              [url="prodotti_log.php?recordID=3<?php echo @$row_Rs_portate['ID']; ?>"]Antipasti di Pesce[/url] </div>
          </div>
          <div class="photos_block">
            <div class="photo_box"> [url="prodotti_log.php?recordID=2<?php echo @$row_Rs_portate['ID']; ?>"][img]../images/primi_di_carne.jpg[/img][/url]

              [url="prodotti_log.php?recordID=2<?php echo @$row_Rs_portate['ID']; ?>"]Primi di Carne[/url] </div>
            <div class="photo_box"> [url="prodotti_log.php?recordID=6<?php echo @$row_Rs_portate['ID']; ?>"][img]../images/Primi_di_pesce.jpg[/img][/url]

              [url="prodotti_log.php?recordID=6<?php echo @$row_Rs_portate['ID']; ?>"]Primi di Pesce[/url] </div>
            <div class="photo_box"> [url="prodotti_log.php?recordID=7<?php echo @$row_Rs_portate['ID']; ?>"][img]../images/secondi_di_carne.jpg[/img][/url]

              [url="prodotti_log.php?recordID=7<?php echo @$row_Rs_portate['ID']; ?>"]Secondi di Carne[/url] </div>
          </div>
          <div class="photos_block">
            <div class="photo_box"> [url="prodotti_log.php?recordID=4<?php echo @$row_Rs_portate['ID']; ?>"][img]../images/secondi_piatti.jpg[/img][/url]

              [url="prodotti_log.php?recordID=4<?php echo @$row_Rs_portate['ID']; ?>"]Secondi di Pesce[/url] </div>
            <div class="photo_box"> [url="prodotti_log.php?recordID=9<?php echo @$row_Rs_portate['ID']; ?>"][img]../images/contorni.jpg[/img][/url]

              [url="prodotti_log.php?recordID=9<?php echo @$row_Rs_portate['ID']; ?>"]Contorni[/url] </div>
            <div class="photo_box"> [url="prodotti_log.php?recordID=8<?php echo @$row_Rs_portate['ID']; ?>"][img]../images/dolci.jpg[/img][/url]

              [url="prodotti_log.php?recordID=8<?php echo @$row_Rs_portate['ID']; ?>"]Dolci[/url] </div>
          </div>
        </div>
        <div class="right_content">
          <h1>I Miei Dati</h1>
          <div class="tip_box">
            <h2></h2>
          </div>
          <div class="tip_box">
            <h2>Riconoscimenti</h2>
            <p class="tips"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p>
            [url="#"]Per saperne di più[/url] </div>
          <h1>Il Mio Preventivo</h1>
          <div class="news_box">
            <div class="news_content">
              <h2>Servizio Catering</h2>
              

     Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore. </p>
            </div>
          </div>
        </div>
        <div class="bottom_content">
          <div class="about_text">
            <h1>Servizi</h1>
            

     Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
          </div>
          <div class="friends_list">
            <h1>Men&ugrave; tipo</h1>
            <ul class="list">[*][url="#"]Menù tipo carne[/url][*][url="#"]Menù tipo Pesce[/url][*][url="#"]Menù tipo carne e pesce[/url][*][url="#"]Menù tipo vegetariano[/url][/list]
          </div>
          <div class="bottom_right"> [img]../images/img_telefono.jpg[/img] 

            La Bottega della Pasta all'Uovo 

            di De Angelis Patrizia Via Niccolò Tommaseo 14 Santa Maria delle Mole Marino (RM) </div>
          <div class="footer"> Webmaster Marco de Angelis [email]info@mdstudioweb.com[/email] </div>
        </div>
      </div>
    </div>

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

  6. #16
    che angelo che sei...

  7. #17
    Questo codice lo ripeti 2 volte.
    1 nella query
    2 nel while
    3. Prova anche con mysql_fetch_array
    Codice PHP:
    $row_DetailRS1 mysql_fetch_assoc($DetailRS1); 
    Qui invece prima del while esegui un if per controllare se ci sono elementi
    Codice PHP:
    $totalRows_DetailRS1 mysql_num_rows($DetailRS1); 
    Il controllo così deve essere
    Codice PHP:
    if($totalRows_DetailRS1 0)
    {
      print 
    "$totalRows_DetailRS1";

    Programmatore e responsabile seo della testata giornalistica www.europacalcio.it - www.canforagennaro.it

  8. #18
    ho fatto le prove che hai tetto compreso l'if ma nulla l'if mi dà valore 1 ma se tolgo il while i risultati del db ci sono tutti questo cosa significa che il mio php è posseduto?

  9. #19
    Prova così
    Codice PHP:
    while ($row  mysql_fetch_assoc($DetailRS1)); 
    {           
      
    $portata $row['Portata'];
      Print 
    "$portata";
      print 
    "<input type=\"checkbox\" name=\"Maychek\"id=\"Maychek\" /> <label for=\"Maychek\"></label>";          
    }           
    ?> 
    Prova anche con mysql_fetch_array
    Programmatore e responsabile seo della testata giornalistica www.europacalcio.it - www.canforagennaro.it

  10. #20
    nulla solo una check

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.