채택완료

mysql 데이터가 안떠요,,,,ㅡㅜ

2018-01-03 (수) 01:14:43 1,971


                            <?
                            $connect=mysql_connect("localhost", "frxxxu", "roxxxxx56");
                            mysql_select_db("frxxxu", $connect);

                            if(!$connect) die("연결에 실패하였습니다.".mysql_error()) ;
                            //쿼리문으로 데이터를 불러오기
                              $query= "select * from bbs_1 where id='test'";
                              mysql_query("set names utf8", $connect);
                              $result=mysql_query($query, $connect);
                              while ($data=mysql_fetch_array($result)) {
                            ?>


                                <TR>
                                <TD  WIDTH='100%' HEIGHT='20'  ALIGN='LEFT' VALIGN='TOP'  BGCOLOR='#346543'>
                                -이름: <?=$data[id]?> &nbsp; &nbsp;
                                -아이디: <?=$data[email]?> &nbsp; &nbsp;
                                -메모: <?=$data[web]?> &nbsp; &nbsp;
                            </td>
                            <?}?>

위코드가  pc서버에서는 db에서 접속해서 뿌려주는데  호스팅 업체를 통할때는 아무것도 안뜨더라구요,,

|

답변 2개 / 댓글 1개

채택된 답변
+20 포인트

phpinfo(); 한번 넣어 보시고 php 7.x.x 이런 식으로 찍혀 있다면 

mysql_connect => mysqli_connect 로 변경해 보시죠.

묵공님의 답변에 추가합니다.

This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0.

PHP 5.5.0에서 사용되지 않으며 PHP 7.0.0에서 제거되었습니다.

mysql_connect  > mysqli_connect
http://php.net/manual/en/function.mysqli-connect.php

mysql_query  >  mysqli_query
http://php.net/manual/en/mysqli.query.php

mysql_fetch_array  >  mysqli_fetch_array
http://php.net/manual/en/mysqli-result.fetch-array.php

답변에 대한 댓글 1개

2018-01-03 (수) 13:03:22
감사감사

답변을 작성하려면 로그인이 필요합니다.