Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 14

Discussione: creazione file setup..

  1. #1

    creazione file setup..

    ho visto ke alcuni script hanno un bel file setup ke crea in automatico database e tabelle..

    ma ke sintassi devo seguire??..mi postate qlke esempio?
    [ SimplyMepis 8 ]Copyleft
    www.mepisitalia.org IL SITO ITALIANO UFFICIALE DI MEPIS
    www.salentomovida.it LA MOVIDA DEL SALENTO HA UN NUOVO PUNTO D'INCONTRO SUL WEB
    [ SUD SOUND SYSTEM MINA FUECU INTRA ALLU SALENTU ]

  2. #2
    Utente bannato
    Registrato dal
    Apr 2004
    Messaggi
    1,392
    Beh, lo puoi fare con mphpmyadmin, devi fare il dump del database che ti serve e salvi tutto il contenuto in un file.sql

  3. #3
    Utente bannato
    Registrato dal
    Apr 2003
    Messaggi
    1,119
    parli di file .sql?
    lo scrivi come se facessi tanti comandi SQL e verranno eseguiti tutti quando scriverai da DOS: (o linux)
    codice:
    mysql < prova.sql > errori.txt

  4. #4
    ok..facciamo finta ke io abbia

    Codice PHP:
    # phpMyAdmin SQL Dump
    # version 2.5.3
    # [url]http://www.phpmyadmin.net[/url]
    #
    # Host: localhost
    # Generato il: 15 Giu, 2004 at 03:08 PM
    # Versione MySQL: 4.0.15
    # Versione PHP: 4.3.3

    # Database : `negozio`


    # --------------------------------------------------------

    #
    # Struttura della tabella `ditta`
    #

    CREATE TABLE `ditta` (
      `
    idint(11NOT NULL auto_increment,
      `
    nometext NOT NULL,
      
    PRIMARY KEY  (`id`)
    TYPE=MyISAM AUTO_INCREMENT=;


    #
    # Struttura della tabella `fatture`
    #

    CREATE TABLE `fatture` (
      `
    idint(11NOT NULL auto_increment,
      `
    nfatttext NOT NULL,
      `
    articolotext NOT NULL,
      `
    desclongtext NOT NULL,
      `
    umtext NOT NULL,
      `
    quantdouble NOT NULL default '0',
      `
    prezzodouble NOT NULL default '0',
      `
    scontodouble NOT NULL default '0',
      `
    importodouble NOT NULL default '0',
      `
    aliquotaint(11NOT NULL default '0',
      `
    dittatext NOT NULL,
      `
    pagatotext NOT NULL,
      `
    giornotext NOT NULL,
      `
    mesetext NOT NULL,
      `
    annotext NOT NULL,
      
    PRIMARY KEY  (`id`)
    TYPE=MyISAM AUTO_INCREMENT=34 ;



    #
    # Struttura della tabella `incassi`
    #

    CREATE TABLE `incassi` (
      `
    idint(11NOT NULL auto_increment,
      `
    incassoint(11NOT NULL default '0',
      `
    giornotext NOT NULL,
      `
    mesetext NOT NULL,
      `
    annotext NOT NULL,
      
    PRIMARY KEY  (`id`)
    TYPE=MyISAM AUTO_INCREMENT=;


    #
    # Struttura della tabella `note`
    #

    CREATE TABLE `note` (
      `
    idint(11NOT NULL auto_increment,
      `
    giornotext NOT NULL,
      `
    mesetext NOT NULL,
      `
    annotext NOT NULL,
      `
    testotext NOT NULL,
      
    PRIMARY KEY  (`id`)
    TYPE=MyISAM AUTO_INCREMENT=;


    # --------------------------------------------------------

    #
    # Struttura della tabella `riepilogo`
    #

    CREATE TABLE `riepilogo` (
      `
    idint(11NOT NULL auto_increment,
      `
    nfatttext NOT NULL,
      `
    tqdouble NOT NULL default '0',
      `
    timdouble NOT NULL default '0',
      `
    tivdouble NOT NULL default '0',
      `
    tfadouble NOT NULL default '0',
      `
    pagatotext NOT NULL,
      `
    giornotext NOT NULL,
      `
    mesetext NOT NULL,
      `
    annotext NOT NULL,
      
    PRIMARY KEY  (`id`)
    TYPE=MyISAM AUTO_INCREMENT=16 ;



    # --------------------------------------------------------

    #
    # Struttura della tabella `um`
    #

    CREATE TABLE `um` (
      `
    idint(11NOT NULL auto_increment,
      `
    nometext NOT NULL,
      
    PRIMARY KEY  (`id`)
    TYPE=MyISAM AUTO_INCREMENT=
    ma il database lo devo creare sempre cn phpmyadmin??
    [ SimplyMepis 8 ]Copyleft
    www.mepisitalia.org IL SITO ITALIANO UFFICIALE DI MEPIS
    www.salentomovida.it LA MOVIDA DEL SALENTO HA UN NUOVO PUNTO D'INCONTRO SUL WEB
    [ SUD SOUND SYSTEM MINA FUECU INTRA ALLU SALENTU ]

  5. #5
    Utente bannato
    Registrato dal
    Apr 2003
    Messaggi
    1,119
    Originariamente inviato da alex86
    ma il database lo devo creare sempre cn phpmyadmin??
    te l'ho appena detto, lo fai con mysql!

  6. #6
    e qual'è la sintassi??..

    il codice lo devo mettere sempre nel file ke o postato prima??
    [ SimplyMepis 8 ]Copyleft
    www.mepisitalia.org IL SITO ITALIANO UFFICIALE DI MEPIS
    www.salentomovida.it LA MOVIDA DEL SALENTO HA UN NUOVO PUNTO D'INCONTRO SUL WEB
    [ SUD SOUND SYSTEM MINA FUECU INTRA ALLU SALENTU ]

  7. #7
    Moderatore di Server Apache L'avatar di marketto
    Registrato dal
    Sep 2001
    Messaggi
    5,858
    Originariamente inviato da alex86
    e qual'è la sintassi??..

    il codice lo devo mettere sempre nel file ke o postato prima??

    fai tutto con php.
    il file .sql è una sequenza di istruzioni SQL per creare le tabelle che serviranno successivamente allo script.
    il tuo setup.php non sarà altro che un'esecuzione di questi comandi:

    ...
    $sql="CREATE TABLE `ditta` (
    `id` int(11) NOT NULL auto_increment,
    `nome` text NOT NULL,
    PRIMARY KEY (`id`)
    ) TYPE=MyISAM AUTO_INCREMENT=4 ;";
    mysql_query($sql) or die("errore");
    ....
    think simple think ringo

  8. #8
    nn sto capendo...

    ho fatto sto file setup.php

    Codice PHP:
    <?
    CREATE DATABASE 
    `negozio`;

    # phpMyAdmin SQL Dump
    # version 2.5.3
    # [url="http://www.phpmyadmin.net"][url]http://www.phpmyadmin.net[/url][/url]
    #
    # Host: localhost
    # Generato il: 15 Giu, 2004 at 03:08 PM
    # Versione MySQL: 4.0.15
    # Versione PHP: 4.3.3

    # Database : `negozio`


    # --------------------------------------------------------

    #
    # Struttura della tabella `ditta`
    #

    CREATE TABLE `ditta` (
      `
    idint(11NOT NULL auto_increment,
      `
    nometext NOT NULL,
      
    PRIMARY KEY  (`id`)
    TYPE=MyISAM AUTO_INCREMENT=;


    #
    # Struttura della tabella `fatture`
    #

    CREATE TABLE `fatture` (
      `
    idint(11NOT NULL auto_increment,
      `
    nfatttext NOT NULL,
      `
    articolotext NOT NULL,
      `
    desclongtext NOT NULL,
      `
    umtext NOT NULL,
      `
    quantdouble NOT NULL default '0',
      `
    prezzodouble NOT NULL default '0',
      `
    scontodouble NOT NULL default '0',
      `
    importodouble NOT NULL default '0',
      `
    aliquotaint(11NOT NULL default '0',
      `
    dittatext NOT NULL,
      `
    pagatotext NOT NULL,
      `
    giornotext NOT NULL,
      `
    mesetext NOT NULL,
      `
    annotext NOT NULL,
      
    PRIMARY KEY  (`id`)
    TYPE=MyISAM AUTO_INCREMENT=34 ;



    #
    # Struttura della tabella `incassi`
    #

    CREATE TABLE `incassi` (
      `
    idint(11NOT NULL auto_increment,
      `
    incassoint(11NOT NULL default '0',
      `
    giornotext NOT NULL,
      `
    mesetext NOT NULL,
      `
    annotext NOT NULL,
      
    PRIMARY KEY  (`id`)
    TYPE=MyISAM AUTO_INCREMENT=;

    ?>
    ma nn funziona..mi dà errore alla seconda linea
    [ SimplyMepis 8 ]Copyleft
    www.mepisitalia.org IL SITO ITALIANO UFFICIALE DI MEPIS
    www.salentomovida.it LA MOVIDA DEL SALENTO HA UN NUOVO PUNTO D'INCONTRO SUL WEB
    [ SUD SOUND SYSTEM MINA FUECU INTRA ALLU SALENTU ]

  9. #9
    mi correggo...scusate!

    Codice PHP:
    <?
    // parametri del database
    $db_host "localhost";
    $db_user "root";
    $db_password "";
    $db_name "negozio";

    $sql="CREATE DATABASE `negozio`";
    mysql_query($sql) or die("errore"); 

    # phpMyAdmin SQL Dump
    # version 2.5.3
    # [url="http://www.phpmyadmin.net"][url]http://www.phpmyadmin.net[/url][/url]
    #
    # Host: localhost
    # Generato il: 15 Giu, 2004 at 03:08 PM
    # Versione MySQL: 4.0.15
    # Versione PHP: 4.3.3

    # Database : `negozio`


    # --------------------------------------------------------

    #
    # Struttura della tabella `ditta`
    #

    $sql="CREATE TABLE `ditta` (
      `id` int(11) NOT NULL auto_increment,
      `nome` text NOT NULL,
      PRIMARY KEY  (`id`)
    ) TYPE=MyISAM AUTO_INCREMENT=4"
    ;
    mysql_query($sql) or die("errore"); 


    #
    # Struttura della tabella `fatture`
    #

    $sql "CREATE TABLE `fatture` (
      `id` int(11) NOT NULL auto_increment,
      `nfatt` text NOT NULL,
      `articolo` text NOT NULL,
      `desc` longtext NOT NULL,
      `um` text NOT NULL,
      `quant` double NOT NULL default '0',
      `prezzo` double NOT NULL default '0',
      `sconto` double NOT NULL default '0',
      `importo` double NOT NULL default '0',
      `aliquota` int(11) NOT NULL default '0',
      `ditta` text NOT NULL,
      `pagato` text NOT NULL,
      `giorno` text NOT NULL,
      `mese` text NOT NULL,
      `anno` text NOT NULL,
      PRIMARY KEY  (`id`)
    ) TYPE=MyISAM AUTO_INCREMENT=34"
    ;
    mysql_query($sql) or die("errore"); 



    #
    # Struttura della tabella `incassi`
    #

    $sql="CREATE TABLE `incassi` (
      `id` int(11) NOT NULL auto_increment,
      `incasso` int(11) NOT NULL default '0',
      `giorno` text NOT NULL,
      `mese` text NOT NULL,
      `anno` text NOT NULL,
      PRIMARY KEY  (`id`)
    ) TYPE=MyISAM AUTO_INCREMENT=5"
    ;
    mysql_query($sql) or die("errore"); 

    ?>
    ma mi dice

    Warning: mysql_query(): Accesso non consentito per l'utente: 'ODBC@localhost' (Password: NO) in c:\programmi\easyphp1-7\www\negozio\setup.php on line 9

    Warning: mysql_query(): A link to the server could not be established in c:\programmi\easyphp1-7\www\negozio\setup.php on line 9
    errore
    [ SimplyMepis 8 ]Copyleft
    www.mepisitalia.org IL SITO ITALIANO UFFICIALE DI MEPIS
    www.salentomovida.it LA MOVIDA DEL SALENTO HA UN NUOVO PUNTO D'INCONTRO SUL WEB
    [ SUD SOUND SYSTEM MINA FUECU INTRA ALLU SALENTU ]

  10. #10
    Moderatore di Server Apache L'avatar di marketto
    Registrato dal
    Sep 2001
    Messaggi
    5,858
    Originariamente inviato da alex86


    ma nn funziona..mi dà errore alla seconda linea

    così non può funzionare. devi eseguire con php le istruzioni SQL:
    mysql_query("CREATE....") or die("errore");
    think simple think ringo

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.