Visualizzazione dei risultati da 1 a 7 su 7

Discussione: errore MySQL

  1. #1

    errore MySQL

    ho un sito paid to click, con uno script vecchiotto simile a questo http://www.dollarclix.org
    il mio sito è questo:http://www.euroclix.us
    e mi dà questo errore :
    Database error: Link-ID == false, connect failed
    MySQL Error: 0 ()
    Session halted.
    ho provato a fare l'upload dei file mysql ma non cambia molto..
    ho fatto il ceckout e il repair database .. ma sono sempre allo stesso punto.. qualcuno ha qualche idea?
    grazie

  2. #2
    Se vuoi aiuto devi postare anche il codice. Io non riesco a capire dove sta l'errore se posti solo il messaggio di errore.

  3. #3
    questo è il codice mysql.php
    spero tu intenda questo.. non sono molto esperto..anzi poco..
    <?
    class DB_Sql {
    var $Host = "localhost"; // Hostname of our MySQL server.
    var $Database = "euroclix_mydata"; // Logical database name on that server.
    var $User = "euroclix_admin"; // User und Password for login.
    var $Password = "xxxxxxxx";

    var $Link_ID = 0; // Result of mysql_connect().
    var $Query_ID = 0; // Result of most recent mysql_query().
    var $Record = array(); // current mysql_fetch_array()-result.
    var $Row; // current row number.

    var $Errno = 0; // error state of query...
    var $Error = "";
    var $num_queries = 0;


    function halt($msg) {
    printf("</td></tr></table>Database error: %s
    \n", $msg);
    printf("MySQL Error: %s (%s)
    \n",
    $this->Errno,
    $this->Error);
    die("Session halted.");
    }



    function free_result($sql) {
    $this->free_result($sql);
    }


    function connect() {
    if ( 0 == $this->Link_ID ) {
    $this->Link_ID=mysql_connect($this->Host, $this->User, $this->Password);
    if (!$this->Link_ID) {
    $this->halt("Link-ID == false, connect failed");
    }
    if (!mysql_query(sprintf("use %s",$this->Database),$this->Link_ID)) {
    $this->halt("cannot use database ".$this->Database);
    }
    }

    }


    function fetch_array($query_id=-1,$query_string="") {
    if ($query_id!=-1) {
    $this->query_id=$query_id;
    }
    if ( isset($this->query_id) ) {
    $this->record = mysql_fetch_array($this->query_id);
    } else {
    if ( !empty($query_string) ) {
    $this->halt("Invalid query id (".$this->query_id.") on this query: $query_string");
    } else {
    $this->halt("Invalid query id ".$this->query_id." specified");
    }
    }
    return $this->record;
    }


    function query($Query_String) {
    // $this->connect();
    $this->num_queries++;
    #printf("
    <font color=red>Debug: query = %s</font>
    ", $Query_String); // Use for debugging
    $this->Query_ID = mysql_query($Query_String,$this->Link_ID);
    $this->Row = 0;
    $this->Errno = mysql_errno();
    $this->Error = mysql_error();
    if (!$this->Query_ID) {
    $this->halt("Invalid SQL: ".$Query_String);
    }
    return $this->Query_ID;
    }


    function next_record() {
    $this->Record = mysql_fetch_array($this->Query_ID);
    $this->Row += 1;
    $this->Errno = mysql_errno();
    $this->Error = mysql_error();
    $stat = is_array($this->Record);
    if (!$stat) {
    mysql_free_result($this->Query_ID);
    $this->Query_ID = 0;
    }
    return $stat;
    }


    function seek($pos) {
    $status = mysql_data_seek($this->Query_ID, $pos);
    if ($status)
    $this->Row = $pos;
    return;
    }


    function num_rows() {
    return mysql_num_rows($this->Query_ID);
    }

    function num_fields() {
    return mysql_num_fields($this->Query_ID);
    }


    function f($Name) {
    return $this->Record[$Name];
    }

    function p($Name) {
    print $this->Record[$Name];
    }

    function affected_rows() {
    return @mysql_affected_rows($this->Link_ID);
    }



    function get_temps() {
    while ($row = mysql_fetch_array($this->Query_ID)) {
    $templ[$row["id"]] = $row['con'];
    }
    echo "$templ[1]
    $templ[2]";
    }

    function get_temp() {
    return mysql_fetch_array($this->Query_ID);
    }

    function query_first($query_string) {
    // does a query and returns first row
    $query_id = $this->query($query_string);
    $returnarray=$this->fetch_array($query_id, $query_string);
    $this->free_result($query_id);
    return $returnarray;
    }


    function sql_close()
    {
    if($this->db_connect_id)
    {
    if($this->query_result)
    {
    @mysql_free_result($this->query_result);
    }
    $result = @mysql_close($this->db_connect_id);
    return $result;
    }
    else
    {
    return false;
    }
    }



    }






    ?>

  4. #4
    Quindi il problema sta nella connessione al database...ma penso che questo già lo sai, se hai scritto tu il codice...in locale funziona? E' probabile che siano i parametri di connessione quelli sbagliati. prova a mettere una echo sui parametri, dove ti da l'errore di connessione.
    Potresti inserire anche un
    echo mysql_error();
    per visualizzare l'errore, mi è stato consigliato proprio ieri, e mi è servito a scovare l'errore.

  5. #5
    no.. non l'ho scritto io.. io sono riuscito a modificare alcuni file php per convertire i guadagni in visite, ma non toccando minimamente questo file.
    secondo te dove dovrei inserire echo?

    prima di questo?
    function connect() {
    if ( 0 == $this->Link_ID ) {
    $this->Link_ID=mysql_connect($this->Host, $this->User, $this->Password);
    if (!$this->Link_ID) {
    $this->halt("Link-ID == false, connect failed");
    }
    if (!mysql_query(sprintf("use %s",$this->Database),$this->Link_ID)) {
    $this->halt("cannot use database ".$this->Database);
    }

  6. #6
    si, puoi metterli anche lì...

    echo $Database;
    echo $User;
    echo $Password;

    o se mettendoli prima della funzione, non va, mettili dentro la funzione quando la condizione da l'errore, quindi dentro questa condizione
    if (!$this->Link_ID) {
    $this->halt("Link-ID == false, connect failed");
    }

  7. #7
    grazie per la tua gentilezza, mi ci picchierò un pò.

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