Skip to content
컴퓨터잡담
2009.11.28 09:00

php 에서 mysql 제어하기

조회 수 28199 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

php 에서 mysql 제어하기

mysql+php 연결을 위한 API


# 주요 API 함수 

*mysql_connect() 함수 
mysql 서버에 작성된 파일의 연결을 시도합니다. 
(형식) 
mysql_connect(string[호스트명],string[사용자명],string[패스워드]) 
(예제) 
$con=mysql_connect("localhost","jhp","blueone") || die ("서버에 접속할수 없습니다."); 

*mysql_pconnect() 함수 
mysql_connect()함수와 동일기능을 함.단,지속적으로 연결된다는 점이 다르고 접속해제를 못하다는 있읍니다. 
(형식) 
mysql_pconnect(string[호스트명,string[사용자명],string[패스워드]) 

*mysql_close() 함수 
연결된 서버와의 접속을 해제합니다. 

*mysql 
(형식) 
mysql(string 데이타베이스명,string 질의,int [연결식별자]) 
주어진 연결식별자를 통해 데이타베이스를 선택하고 질의어를 통해 sql문장을 실행합니다.연결식별자생략시는 mysql서버와 연결된것이 있는지 찾아 자동으로 연결시도 
(예제) 
<? 
$conn=mysql_connect("localhost","php","12"); 
$sql="select * from address "; 
$queryid=mysql("TEST",$sql,$id); 
.... 
?> 

*mysql_create_db() 함수 
(형식) 
mysql_create_db(string 데이타베이스명,int [연결식별자]) 
데이타 베이스 생성 함수며,생성되면 true값을 ,실패하면 false 반환함 
(예제) 
<? 
$conn=mysql_connect("localhost","php","12") 
$newdb=mysql_create_db("Teston",$conn); 
if($newdb) echo("새로운 데이타 베이스 생성되었습니다."); 
mysql_close($conn); 
?> 

*mysql_drop_db() 함수 
(형식) 
mysql_drop_db(string 데이타베이스명,int[연결식별자]) 
데이타베이스를 삭제한다. 
(예제) 
<? 
$conn=mysql_connect("localhost","php","12"); 
$newdb=mysql_create_db("testtwo",$conn); 
if($newdb) echo("새로운 데이타베이스가 생성되었습니다."); 
$dropdb=mysql_drop_db("testtwo",$conn); 
if($dropdb) echo("데이타베이스를 삭제되었습니다."); 
mysql_close($conn); 
?> 

*mysql_select_db() 함수 
(형식) 
mysql_select_db(string 데이타베이스명,int[연결식별자]) 
특정데이터베이스를 선택합니다. 
(예제) 
<? 
$conn=mysql_connect("localhost","php","12"); 
$mysql_select_db("insa_card",$conn); 
$query="select name,part,jikwi from insa"; 
...... 
?> 

*mysql_query() 함수 
(형식) 
mysql_query(string 질의어,int[연결식별자]) 
선택된 데이터베이스에 질의어를 보내 실행합니다. 
(예제) 
<? 
$conn=mysql_connect("localhost","php","12"); 
$mysql_select_db("insa_card",$conn); 
$query="select name,part,jikwi from insa"; 
$queryid=mysql_query($query,$conn); 
..... 
?> 

*mysql_db_query() 함수 
(형식) 
mysql_db_query(string 데이타베이스명,string 질의어,int[식별자]) 
mysqlquery를 mysql로 보냅니다. 

*mysql_affected_rows() 함수 
(형식) 
mysql_affected_rows(int[연결식별자]) 
insert,update,delete등이 수행한 레코드의 수를 반환함.select문







TAG •
로그인 후 댓글쓰기가 가능합니다.

?

  1. 30
    Oct 2013
    17:04

    ahk) autohotkey 엑셀(Excel)에서 행값 증가시키기

    CategoryAutoHotKey Views37410
    Read More
  2. 21
    Apr 2023
    20:10

    DiffusionWrapper has 859.52 M params.

    Category파이썬 Views37147
    Read More
  3. 22
    Feb 2012
    07:24

    Autohotkey) Find WM_COMMAND parameter with Winspector

    CategoryAutoHotKey Views35863
    Read More
  4. 30
    Jun 2009
    08:44

    자바스크립트/CSS 트리를 이용한 예제 프로그램 쉽게만들기

    Category컴퓨터잡담 Views35631
    Read More
  5. 23
    Sep 2023
    22:25

    2023-09-23 서버다운 후 복구완료

    Category컴퓨터잡담 Views35623
    Read More
  6. 30
    Jun 2009
    15:31

    .htaccess와 워터마킹을 이용한 이미지 링크 방지

    Category컴퓨터잡담 Views34917
    Read More
  7. 31
    Dec 2011
    17:18

    autohotkey) Virus?

    CategoryAutoHotKey Views34677
    Read More
  8. 30
    Oct 2013
    16:59

    ahk) autohotkey 글자 자르기 방법

    CategoryAutoHotKey Views34636
    Read More
  9. 08
    Oct 2013
    10:24

    IPTIME N904 모델에서 멀티캐스트 프로토콜(IGMP) 설정하는 방법

    Category컴퓨터잡담 Views34236
    Read More
  10. 18
    Sep 2012
    13:43

    옵티머스G 배터리 일체형은 절대 비추천합니다.

    Category컴퓨터잡담 Views34148
    Read More
  11. 30
    Nov 2009
    08:15

    TIME_WAIT 줄이기(소켓이 부족하여 프로세스 강제중단을 막기위해)

    Category컴퓨터잡담 Views34107
    Read More
  12. 30
    Oct 2013
    17:11

    autohotkey) 오토핫키에서 자주쓰는 함수모음

    CategoryAutoHotKey Views33652
    Read More
  13. 05
    Aug 2009
    17:22

    네이버 많이 본 뉴스 PHP로 RSS 출력 만들기

    Category컴퓨터잡담 Views33649
    Read More
  14. 31
    Jul 2013
    13:22

    autohotkey) 30분마다 자동으로 디스크 정리하기

    CategoryAutoHotKey Views33066
    Read More
  15. 20
    Feb 2013
    07:38

    C# - etrade api site 게시물

    CategoryVisual C++ Views32885
    Read More
  16. 30
    Jun 2009
    15:29

    CURL 을 이용한 GET/POST 값 넘기기

    Category컴퓨터잡담 Views32785
    Read More
  17. 20
    Oct 2009
    08:35

    PHP로 FTP 접속 / 업로드 / 다운로드 등의 컨트롤 소스

    Category컴퓨터잡담 Views32741
    Read More
  18. 30
    Jun 2009
    15:36

    현재 쿠키,세션 값 전부 보기

    Category컴퓨터잡담 Views32610
    Read More
  19. 30
    Oct 2013
    16:51

    ahk) 열려진 엑셀창의 값 불러오기

    CategoryAutoHotKey Views32524
    Read More
  20. 14
    Jul 2022
    15:08

    특정 파일을 제외한 현재 디렉토리 내의 모든 파일을 삭제하는 배치파일

    Category컴퓨터잡담 Views32395
    Read More
Board Pagination Prev 1 2 3 4 5 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소