Navigazione

    Privacy - Termini e condizioni
    © 2020 Search On Media Group S.r.l.
    • Registrati
    • Accedi
    • CATEGORIES
    • Discussioni
    • Non letti
    • Recenti
    • Hashtags
    • Popolare
    • Utenti
    • Stream
    • Interest
    • Categories
    1. Home
    2. baxxter
    3. Post
    B

    baxxter

    @baxxter

    • Profilo
    • Chi segue 0
    • Da chi è seguito 0
    • Discussioni 2
    • Post 3
    • Migliore 0
    • Gruppi 0
    Iscrizione Ultimo Accesso
    Località Brescia Età 36
    0
    Reputazione
    3
    Post
    0
    Visite al profilo
    0
    Da chi è seguito
    0
    Chi segue
    User Newbie

    Post creati da baxxter

    • RE: Aiuto per sondaggio PHP

      a scusate mi sono dimenticato il file della tabelle che cè nel database:

      install.php
      [PHP]<?php

      require("config.php");

      mysql_query("CREATE TABLE sonda (

      id INT( 11 ) NOT NULL AUTO_INCREMENT ,

      tot_1 VARCHAR( 255 ) DEFAULT 0 NOT NULL ,

      tot_2 VARCHAR( 255 ) DEFAULT 0 NOT NULL ,

      tot_3 VARCHAR( 255 ) DEFAULT 0 NOT NULL ,

      tot_4 VARCHAR( 255 ) DEFAULT 0 NOT NULL ,

      INDEX (id));");

      mysql_query("INSERT INTO sonda VALUES ('',0,0,0,0)");

      echo "Linstallazione è avvenuta con successo!<br />";
      ?>[/PHP]

      postato in Coding
      B
      baxxter
    • Aiuto per sondaggio PHP

      Salve, io è da tanto che provo a fare funzionare un sondaggio in php ma non riesco a fargli salvare i dati nel database e a farglieli richiamare. vi posto l'intero script:

      config.php
      [php]<?php

      $mysql[host] = "localhost";
      $mysql[user] = "root";
      $mysql[pass] = "";
      $mysql[name] = "dbsond";

      $question = "Come vi sembra il nostro sito?";
      $answers = array("Stupendo", "Bello", "Brutto", "Schifo");

      @mysql_connect($mysql[host], $mysql[user], $mysql[pass]);
      @mysql_select_db($mysql[name]);
      ?>[/php]index.php
      [php]<?php

      require("config.php");

      echo '<form action="vote.php" method="post">';
      echo "<strong>{$question}</strong><br><br>";

      for ($i = 0; $i <= count($answers) - 1; $i++)

      {

      echo "<input type="radio" name="a" value=' . ($i + 1) . '>{$answers*}<br>";
      }

      echo '<br><input type="submit" value="Vota">';
      echo '<a href="results.php">Risultati</a>';
      echo '</form>';
      ?>[/php]vote.php
      [php]<?php

      require("config.php");

      mysql_query("UPDATE sonda SET tot_{$POST[a]} = tot{$_POST[a]} + 1");
      header("Location: results.php");

      ?>[/php]results.php
      [php]<?php

      require("config.php");

      $query = @mysql_query("SELECT * FROM sonda");
      $result = @mysql_fetch_array($query);

      echo "<strong>{$question}</strong><br><br>";
      for ($x = 1; $x <= count($answers); $x++)

      {

      $total = $total + $result[tot_ . $x];
      }

      for ($i = 1; $i <= count($answers); $i++)

      {

      @$percent = $result[tot_ . $i] / $total;
      $percent = $percent * 100;
      $percent = number_format($percent, 1);
      echo "" . $answers[$i - 1] . " (<strong>{$percent}%</strong>)<br />";
      }

      ?>[/php]

      qualcuno sa perchè non vengono aggiunti i dati al database e neanche ripresi?
      Ringrazio in anticipo.

      postato in Coding
      B
      baxxter
    • Aiuto sondaggio PHP

      Salve a tutti, sono nuovo sul forum e spero di aver scritto nella sezione giusta.
      Io ho cercato di usare il sondaggio postato nel sito di Giorgio Tave è solo che dopo aver selezionato l'opzione nel form mi restituisce il messaggio "Errore impossibile votare" che è presente nell'if della pagina vai.php

      Qualcuno sa cosa può esserci di sbagliato?
      Ringrazio in anticipo.

      postato in Coding
      B
      baxxter