dbconfig.txt 에서 localhost 가져오면 에러납니다.

dbconfig.txt 에서 localhost 가져오면 에러납니다.

QA

dbconfig.txt 에서 localhost 가져오면 에러납니다.

답변 1

본문

dbconfig.txt 첫째줄에 localhost를 저장하였습니다.

그리고 config.php 파일에서 불러왔는데 자꾸 에러가 납니다.

 

뭔가 기본적인 문법에러 같은데 뭔지 도통 모르겠네요.

 

<?php
$file = 'dbconfig.txt';
$current = file($file);
echo $current[0].'<br>';
echo $current[1].'<br>';
echo $current[2].'<br>';

if(isset($current[3])){
$pass = $current[3];
echo $current[3].'<br>';
} else {
$pass = '';
echo '<br>';
};

$conn = mysqli_connect($current[0], 'root', '', 'porche');

?>

이 질문에 댓글 쓰기 :

답변 1

if(isset($current[3])){
$pass = $current[3];
echo $current[3].'<br>';
} else {
$pass = '';
echo '<br>';
}; <- 이거 삭제해 보세요. ;

ini_set('display_errors', 1);

ini_set('error_reporting', E_ALL);

상단에 등록하면 오류메시지를 볼 수 있습니다.

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 125,873
© SIRSOFT
현재 페이지 제일 처음으로