1064 sql에러..이거 뭘까요...
본문
select * from where bo_table = 'notice'
1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where bo_table = 'notice'' at line 1
error file : /ja/index.php
갑자기 위와같은 에러가 떴어요...
딱히 만진데두 없는거같은데..
mysql 문제일까요??
여태 헤메다가 방법을 못찾아서 글 남겨요..도와주세요..
답변 7
저런식으로 오류가 나타는경우 대부분 select * from $blahblah where .... 와 같은 식으로 사용하여 $blahblah의 값이 없는 경우 발생합니다.
올려주신 본문에서는 $g5['board_table']의 값이 존재하지 않는 것 같습니다.
테이블 명이 없습니다.
select * from 여기에 테이블 명 where bo_table = 'notice'
이 들어가야 될겁니다.
바쁜시간 쪼개서 댓글 달아주셔서 감사합니다...
문제의 페이지가 index.php 인거같은데요..
현재 index페이지는 아래와 같아요.
---------------------------------------------------------------------------
<?php
define('_INDEX_', true);
include_once('./_common.php');
// 초기화면 파일 경로 지정 : 이 코드는 가능한 삭제하지 마십시오.
if ($config['cf_include_index']) {
if (!@include_once($config['cf_include_index'])) {
die('기본환경 설정에서 초기화면 파일 경로가 잘못 설정되어 있습니다.');
}
return; // 이 코드의 아래는 실행을 하지 않습니다.
}
if (G5_IS_MOBILE) {
include_once(G5_MOBILE_PATH.'/index.php');
return;
}
include_once('./_head.php');
?>
<div>
<div>
<!-- main--->
<style type="text/css">
#featured { width: 1050px; height: 450px; background: #009cff url('orbit/loading.gif') no-repeat center center; overflow: hidden; }
/* Want a different Loading GIF - visit http://www.webscriptlab.com/ - that's where we go this one :) */
</style>
<!-- Attach our CSS -->
<link rel="stylesheet" href="orbit.css">
<!--[if IE]>
<style type="text/css">
.timer { display: none !important; }
div.caption { background:transparent; filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000);zoom: 1; }
</style>
<![endif]-->
<!-- Attach necessary scripts -->
<script type="text/javascript" src="jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="jquery.orbit.min.js"></script>
<!-- Run the plugin -->
<script type="text/javascript">
$(window).load(function() {
$('#featured').orbit({
'bullets': true,
'timer' : true,
'animation' : 'horizontal-slide'
});
});
</script>
</head>
<body>
<div id="featured">
<img src="http://ja7bang.cafe24.com/ja/image/mainimg_main.jpg" alt="Link" rel="mainimg1" />
<a href="#" target="_blank"><img src="http://ja7bang.cafe24.com/ja/image/mainimg_main.jpg" alt="Ezio" rel="ezioCaption" /></a>
<img src="http://ja7bang.cafe24.com/ja/image/mainimg_main.jpg" alt="Master Chief" />
<img src="http://ja7bang.cafe24.com/ja/image/mainimg_main.jpg" alt="Marcus Fenix" rel="marcusCaption" />
</div>
<span class="orbit-caption" id="mainimg1">언제나 중앙테라코는 고객님들을 위합니다.</span> <!---main end--->
</div>
<div>
<div style="width:1050px;background-image:url(http://ja7bang.cafe24.com/ja/img/background_main_bar.png); height:70px;"><img src=http://ja7bang.cafe24.com/ja/img/main_img_company.gif></div>;
<div style="width:1050px; background-image:url(http://ja7bang.cafe24.com/ja/img/background_main_bar2.png); height:200px;">
<div style="float:left;"><img src=http://ja7bang.cafe24.com/ja/img/main_img_company1.jpg></div>;
<div style="float:left; margin-left:40px;"><img src=http://ja7bang.cafe24.com/ja/img/main_img_company1.jpg></div>;
<div style="float:right; "><img src=http://ja7bang.cafe24.com/ja/img/main_img_company1.jpg></div>;
</div>
<div></div>
</div>
<div>
<!-- 최신글 시작 { -->
<?php
// 최신글
$sql = " select bo_table
from `{$g5['board_table']}` a left join `{$g5['group_table']}` b on (a.gr_id=b.gr_id)
where a.bo_device <> 'mobile' ";
if(!$is_admin)
$sql .= " and a.bo_use_cert = '' ";
$sql .= " order by b.gr_order, a.bo_order ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
if ($i%2==1) $lt_style = "margin-left:20px";
else $lt_style = "";
?>
<div style="float:left;<?php echo $lt_style ?>">
<?php
// 이 함수가 바로 최신글을 추출하는 역할을 합니다.
// 사용방법 : latest(스킨, 게시판아이디, 출력라인, 글자수);
echo latest("basic", $row['bo_table'], 5, 25);
?>
</div>
<?php
}
?>
<!-- } 최신글 끝 -->
</div>
</div>
<?php
include_once('./_tail.php');
?>
-----------------------------------------------------------------------
여기서 뭐가 틀린건지.....
제가 워낙 초보다보니....ㅠ
제 육안으로는 sql 쪽으로는 따옴표가 잘 닫힌거같은데..
테이블명은 어떻게 넣는건지...에휴..
건드리면 더 이상해지네요....
뭐가 문제일까요?? 한번 봐주시겠어요...
'index.php'에는 이상이 없는 듯 하네요.
이미지 닫기 소스 </div> 뒤에 필요 없는 ; 가 4개 있는 것은 삭제해야겠네요.
그래도 해결 안된다면... 이것 입니다
파일 인코딩... utf-8 로 설정되었는지 확인
dbconnect.php 파일에 한글이 깨졌나 확인하세요
그렇다면 파일인코딩 오류 입니다.
덕분에 잘 해결되었습니다.
감사합니다^^