function 안에 DB 접속방법
본문
안녕하세요.
새페이지에서 function을 불러와서 보여줄려고 하는데
DB 접속이 안되네요.
global 어떤 이름을 줘야 gb5 table에 접속이 될까요?
function show_avatar($avatar_id)
{
global $config;
$avatar = " select ava1,ava2,ava3,ava4,ava5,ava6,ava7,ava8,ava9 from avatar_member_table where user_id = '$avatar_id' ";
$data = sql_query($avatar);
$ava_plugin_url = G5_PLUGIN_URL;
return "<DIV id=\"character\" style=\"position:relative; width:120; height:160;\"> <!-- overflow:hidden;-->
<div id=\"layer1\" style=\"position:absolute; left:0; top:0; z-index:1;\"><img id=\"ImgChar1\" src=\"{$ava_plugin_url}/avatar/charimg/$data[ava1]\" border=\"0\" width=\"120\" height=\"160\"></div>
<div id=\"layer2\" style=\"position:absolute; left:0; top:0; z-index:3;\"><img id=\"ImgChar2\" src=\"{$ava_plugin_url}/avatar/charimg/$data[ava2]\" border=0 width=\"120\" height=\"160\"></div>
<div id=\"layer3\" style=\"position:absolute; left:0; top:0; z-index:2;\"><img id=\"ImgChar3\" src=\"{$ava_plugin_url}/avatar/charimg/$data[ava3]\" border=0 width=\"120\" height=\"160\"></div>
<div id=\"layer4\" style=\"position:absolute; left:0; top:0; z-index:5;\"><img id=\"ImgChar4\" src=\"{$ava_plugin_url}/avatar/charimg/$data[ava4]\" border=0 width=\"120\" height=\"160\"></div>
<div id=\"layer5\" style=\"position:absolute; left:0; top:0; z-index:4;\"><img id=\"ImgChar5\" src=\"{$ava_plugin_url}/avatar/charimg/$data[ava5]\" border=0 width=\"120\" height=\"160\"></div>
<div id=\"layer6\" style=\"position:absolute; left:0; top:0; z-index:6;\"><img id=\"ImgChar6\" src=\"{$ava_plugin_url}/avatar/charimg/$data[ava6]\" border=0 width=\"120\" height=\"160\"></div>
<div id=\"layer7\" style=\"position:absolute; left:0; top:0; z-index:7;\"><img id=\"ImgChar7\" src=\"{$ava_plugin_url}/avatar/charimg/$data[ava7]\" border=0 width=\"120\" height=\"160\"></div>
<div id=\"layer8\" style=\"position:absolute; left:0; top:0; z-index:8;\"><img id=\"ImgChar8\" src=\"{$ava_plugin_url}/avatar/charimg/$data[ava8]\" border=0 width=\"120\" height=\"160\"></div>
<div id=\"layer9\" style=\"position:absolute; left:0; top:0; z-index:0;\"><img id=\"ImgChar9\" src=\"{$ava_plugin_url}/avatar/charimg/$data[ava9]\" border=0 width=\"120\" height=\"160\"></div>
<div id=\"layer10\" style=\"position:absolute; left:0; top:0; z-index:9;\"><img id=\"ImgChar10\"src=\"{$ava_plugin_url}/avatar/charimg/img_blank.gif\" border=0 width=\"120\" height=\"160\"></div></DIV>";
}
답변 1
이렇게 바꿔보시겠어요?
이것때문에 그럴수 있어요
//$data =sql_query($avatar);
$data = sql_fetch($avatar);
그리고 common.php파일 잘 불러와지나 체크도 해보시고요
!-->
답변을 작성하시기 전에 로그인 해주세요.