Patitiko'nun paylaştığı pusta aldığım hatalar

Katılım
20 Eylül 2013
Mesajlar
972
Reaction score
1
Puanları
38
Yaş
36
öncelikle paylaşılan pus bu linktekidir http://www.ko-fox.com/web-dosyasi-paylasimlari/31259-1299-1453-1886-power-up-store-pus.html



evde zevkine localde uğraşıyorum



versiyon 1453 - SQL SERVER 2014. dbye sql kodlarımı uyguladım



ODBC.class php ayarlarım böyle



<?php

$errors = array(

1 => 'Require $dbuser and $dbpassword to connect to a database server',

2 => 'Error establishing ODBC database connection. Correct user/password? Correct hostname? Database server running?',

3 => 'Require $dbname to select a database',

4 => 'ODBC database connection is not active',

5 => 'Unexpected error while trying to select database'

);



class Odbc {



public $dbuser, $dbpass, $dbname, $dbhost;

private $rval = false;



public function __construct(){

global $errors,$config;

$this->dbname = $config['kn_online'];

$this->dbuser = $config['fatih1'];

$this->dbpass = $config['123456'];

if(!odbc_connect($this->dbname,$this->dbuser,$this->dbpass)){

die('Bağlantı kurulamadı');

}

}



public function writeLogs($error){

/*if(!file_exists("errors.log")){

touch("errors.log");

}

$file = fopen ("errors.log" , 'aw');

$text = "$error\n";

fwrite($file,$text);

fclose($file);

*/

return;

}



public function dbConnect(){

global $errors,$config;

$this->dbuser = $config["fatih1"];

$this->dbpass = $config["123456"];

$this->dbname = $config["kn_online"];

$this->dbhost = $config["127.0.0.1"];



if(!$this->dbuser){

$this->writeLogs($errors[1]." \r\n in ".__FILE__." on line ".__LINE__);

}else if(!$this->dbconn = @odbc_connect($this->dbname,$this->dbuser,$this->dbpass)){

$this->writeLogs($errors[2]." \r\n in ".__FILE__." on line ".__LINE__);

}else{

return true;

}

}



public function selectDb(){

global $errors;

if(!$this->dbname){

$this->writeLogs($errors[3]." \r\n in ".__FILE__." on line ".__LINE__);

}

return true;

}



public function query($query){

if($this->dbConnect()){

if($this->selectDb()){

$this->result = @odbc_exec($this->dbconn,$query);

if(!$this->result){

$this->writeLogs(@odbc_error() ." \r\n in ".__FILE__." on line ".__LINE__);

return false;

}

$this->rows_affected = @odbc_num_rows($this->result);

if(!$this->rval){

return $this->rows_affected;

}else{

return $this->result;

}

}

}

}



public function results($query){

$this->last_result = null;

$this->rval = true;

if($this->result = $this->query($query)){

$num_rows=0;

while ($row = @odbc_fetch_object($this->result)){

$this->last_result[$num_rows] = $row;

$num_rows++;

}

if(!empty($this->last_result)){

return $this->last_result;

}

}

}



public function row($query,$x=0){

$this->last_result = null;

$this->rval = true;

if($this->result = $this->query($query)){

$num_rows=0;

while ($row = @odbc_fetch_object($this->result)){

$this->last_result[$num_rows] = $row;

$num_rows++;

}

if(!empty($this->last_result[$x])){

return $this->last_result[$x];

}

}

}



public function col($query,$x=0,$y=1){

$this->last_result = null;

$this->rval = true;

if($this->result = $this->query($query)){

$num_rows=0;

while (@odbc_fetch_row($this->result)){

$this->last_result[$num_rows] = @odbc_result($this->result,$y);

$num_rows++;

}

if(!empty($this->last_result[$x])){

return ($this->last_result[$x]);

}

}

}

}

?>



aldığım hata ise bu



Kod:
[B]Warning: odbc_connect() [[URL="http://127.0.0.1/pus/function.odbc-connect"]function.odbc-connect[/URL]]: SQL error: [Microsoft][ODBC Driver Manager] Veri kayna�� ad� bulunamad� ve varsay�lan s�r�c� belirtilmemi�, SQL state IM002 in SQLConnect in [B]C:\AppServ\www\pus\ODBC.class.php on line [B]21

Bağlantı kurulamadı[/B][/B][/B]



odbc.class phpdeki 21i bulmak için notepad++ ile ctrl + g yaparak 21 aratıyorum burası geliyor

if(!odbc_connect($this->dbname,$this->dbuser,$this->dbpass)){





buradaki dbname yi kn_online , dbuser i fatih1 ve dbpass i 123456 yaptığımda ise aldığım hata bu



Kod:
[B]Parse error: syntax error, unexpected T_LNUMBER, expecting T_STRING or T_VARIABLE or '{' or '$' in [B]C:\AppServ\www\pus\ODBC.class.php on line [B]21[/B][/B][/B]



sorunu nasıl çözebilirim anlamış değilim
 
Cevap: Patitiko'nun paylaştığı pusta aldığım hatalar



ODBC.class dosyasının 21. satırında fazladan tırnak mevcut onu kaldır düzelir.
 
Cevap: Patitiko'nun paylaştığı pusta aldığım hatalar



sorunu @Ozkanozdemir çözdü . çözümü ise



$this->dbname = $config['DBNAME'];

$this->dbuser = $config['DBUSER'];

$this->dbpass = $config['DBPASS'];

if(!odbc_connect($this->dbname,$this->dbuser,$this->dbpass)){

die('Bağlantı kurulamadı');



21.satır üstlerini kendime göre ayarlamıştım aslında yukarıdaki gibi olacakmış



oyun içi pustan görüntü . sadece menü eklemelerini kendim yapacağım.



 
Geri
Üst Alt
Reklam
Reklam