Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 13
  1. #1

    [mysql] Si blocca l'output della pagina!

    Buon pomeriggio e buona domenica a tutti!

    Sto cercando di imparare ad utilizzare mysql con PHP, ma incontro subito notevoli difficoltà.
    Sono assolutamente principiante, e credo di commettere qualche errore grossolano per avere un problema del genere, quindi spero che qualcuno di voi mi possa indicare la strada giusta.

    Uso PHP in locale versione 5.2.6, su Apache 2.2.9; ho scaricato e installato mySQL versione 5.1, e con il programmino di gestione ho creato il mio database contenente una tabella che vorrei provare a riempire da script PHP.

    Seguendo l'insegnamento della guida proposta in questo sito, ho elencato nella mia pagina i valori necessari per la connessione al DB, e ho cercato di conettermi:
    Codice PHP:
    <?php
    $host 
    "localhost";
    $username "ale";
    $password "xxx";
    $db mysql_connect($host$username$password);
    L'output della pagina nel browser si interrompe esattamente nel momento in cui incontra l'istruzione "$db = mysql_connect($host, $username, $password)", e TUTTO quello che si trova dopo, non compare........ perchè?
    ieiu --

  2. #2
    ...ho visto dal file di configurazione di PHP che c'è una porta predefinita per l'accesso, n°3306, quindo ho provato a modificare la variabile in
    Codice PHP:
    $host "localhost:3306"
    ma niente...

    ho provato subito dopo l'istruzione "$db = ......" ad inserire qualsiasi cosa, ma tutto ciò che si trova dopo non viene inviato al browser!

    L'errore è un po' strano, e credo si tratti di qualcosa che sto sbagliando grossolanamente a causa della mia assoluta non esperienza, spero qualcuno di voi mi aiuti.

    Grazie!
    ieiu --

  3. #3

  4. #4

    $db = mysql_connect()

    Ciao Filippo,
    grazie del tuo interessamento...!

    L'errore in questione viene così definito:
    "Fatal error: Call to undefined function mysql_connect() in ...indirizzo...\iscrizione4.php on line 47"

    E nella riga 47 naturalmente c'è l'istruzione in oggetto...
    ieiu --

  5. #5
    che? L'errore è che lo mysql_connect(); non esista? forse un'errore del compilazione di PHP?

    Dennis M.
    Nuovo Blog di Programmazione! (Lo ha i tutti tipi! PHP e C/C++)
    Per piacere lo supporti!

  6. #6

    Re: $db = mysql_connect()

    Originariamente inviato da ieiumama
    L'errore in questione viene così definito:
    "Fatal error: Call to undefined function mysql_connect() in ...indirizzo...\iscrizione4.php on line 47"
    La versione del PHP che stai utilizzando non ha l'estensione MySQL attiva ...

    Apri il php.ini, abilita l'estensione MySQL e riavvia il web server.

  7. #7
    Grazie.
    Stasera provo a verificare poi ti scrivo il risultato.

    Mille grazie. Sapevo che non doveva trattarsi di un errore di scrittura del codice, ma di qualche impostazione del genere, che non conosco!!
    ieiu --

  8. #8

    ancora niente...

    questa è la parte del file php.ini che riguarda mySQL...
    sembra tutto OK...... o no?
    codice:
    [MySQL]
    ; Allow or prevent persistent links.
    mysql.allow_persistent = On
    
    ; Maximum number of persistent links.  -1 means no limit.
    mysql.max_persistent = -1
    
    ; Maximum number of links (persistent + non-persistent).  -1 means no limit.
    mysql.max_links = -1
    
    ; Default port number for mysql_connect().  If unset, mysql_connect() will use
    ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
    ; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
    ; at MYSQL_PORT.
    mysql.default_port = 3306
    
    ; Default socket name for local MySQL connects.  If empty, uses the built-in
    ; MySQL defaults.
    mysql.default_socket =
    
    ; Default host for mysql_connect() (doesn't apply in safe mode).
    mysql.default_host =
    
    ; Default user for mysql_connect() (doesn't apply in safe mode).
    mysql.default_user =
    
    ; Default password for mysql_connect() (doesn't apply in safe mode).
    ; Note that this is generally a *bad* idea to store passwords in this file.
    ; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
    ; and reveal this password!  And of course, any users with read access to this
    ; file will be able to reveal the password as well.
    mysql.default_password =
    
    ; Maximum time (in seconds) for connect timeout. -1 means no limit
    mysql.connect_timeout = 60
    
    ; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
    ; SQL-Errors will be displayed.
    mysql.trace_mode = On
    
    [MySQLi]
    
    ; Maximum number of links.  -1 means no limit.
    mysqli.max_links = -1
    
    ; Default port number for mysqli_connect().  If unset, mysqli_connect() will use
    ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
    ; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
    ; at MYSQL_PORT.
    mysqli.default_port = 3306
    
    ; Default socket name for local MySQL connects.  If empty, uses the built-in
    ; MySQL defaults.
    mysqli.default_socket =
    
    ; Default host for mysql_connect() (doesn't apply in safe mode).
    mysqli.default_host =
    
    ; Default user for mysql_connect() (doesn't apply in safe mode).
    mysqli.default_user =
    
    ; Default password for mysqli_connect() (doesn't apply in safe mode).
    ; Note that this is generally a *bad* idea to store passwords in this file.
    ; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw")
    ; and reveal this password!  And of course, any users with read access to this
    ; file will be able to reveal the password as well.
    mysqli.default_pw =
    
    ; Allow or prevent reconnect
    mysqli.reconnect = Off
    
    [mSQL]
    ; Allow or prevent persistent links.
    msql.allow_persistent = On
    
    ; Maximum number of persistent links.  -1 means no limit.
    msql.max_persistent = -1
    
    ; Maximum number of links (persistent+non persistent).  -1 means no limit.
    msql.max_links = -1
    
    [OCI8]
    ; enables privileged connections using external credentials (OCI_SYSOPER, OCI_SYSDBA)
    ;oci8.privileged_connect = Off
    
    ; Connection: The maximum number of persistent OCI8 connections per
    ; process. Using -1 means no limit.
    ;oci8.max_persistent = -1
    
    ; Connection: The maximum number of seconds a process is allowed to
    ; maintain an idle persistent connection. Using -1 means idle
    ; persistent connections will be maintained forever.
    ;oci8.persistent_timeout = -1
    
    ; Connection: The number of seconds that must pass before issuing a
    ; ping during oci_pconnect() to check the connection validity. When
    ; set to 0, each oci_pconnect() will cause a ping. Using -1 disables
    ; pings completely.
    ;oci8.ping_interval = 60
    
    ; Tuning: This option enables statement caching, and specifies how
    ; many statements to cache. Using 0 disables statement caching.
    ;oci8.statement_cache_size = 20
    
    ; Tuning: Enables statement prefetching and sets the default number of
    ; rows that will be fetched automatically after statement execution.
    ;oci8.default_prefetch = 10
    
    ; Compatibility. Using On means oci_close() will not close
    ; oci_connect() and oci_new_connect() connections.
    ;oci8.old_oci_close_semantics = Off
    
    [PostgresSQL]
    ; Allow or prevent persistent links.
    pgsql.allow_persistent = On
    
    ; Detect broken persistent links always with pg_pconnect().
    ; Auto reset feature requires a little overheads.
    pgsql.auto_reset_persistent = Off
    
    ; Maximum number of persistent links.  -1 means no limit.
    pgsql.max_persistent = -1
    
    ; Maximum number of links (persistent+non persistent).  -1 means no limit.
    pgsql.max_links = -1
    
    ; Ignore PostgreSQL backends Notice message or not.
    ; Notice message logging require a little overheads.
    pgsql.ignore_notice = 0
    
    ; Log PostgreSQL backends Noitce message or not.
    ; Unless pgsql.ignore_notice=0, module cannot log notice message.
    pgsql.log_notice = 0
    ieiu --

  9. #9
    ... si ricomincia dalle basi ...

    Cerca:

    Codice PHP:
    ;extension=php_mysql.dll 
    e sostituiscilo con

    Codice PHP:
    extension=php_mysql.dll 

  10. #10

    ... :(

    ...fatto...
    praticamente ho aggiunto l'ultima riga
    codice:
    ;;;;;;;;;;;;;;;;;;;;;;
    ; Dynamic Extensions ;
    ;;;;;;;;;;;;;;;;;;;;;;
    ;
    ; If you wish to have an extension loaded automatically, use the following
    ; syntax:
    ;
    ;   extension=modulename.extension
    ;
    ; For example, on Windows:
    ;
    ;   extension=msql.dll
    ;
    ; ... or under UNIX:
    ;
    ;   extension=msql.so
    ;
    ; Note that it should be the name of the module only; no directory information
    ; needs to go here.  Specify the location of the extension with the
    ; extension_dir directive above.
    
    extension=php_mysql.dll;
    ieiu --

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.