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

php 에서 mysql 제어하기

조회 수 28200 추천 수 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. 27
    Mar 2010
    08:22

    [JavaScript] 자바스크립트 함수 총정리!!

    Category컴퓨터잡담 Views12514
    Read More
  2. 27
    Mar 2010
    11:13

    ajax의 XMLHttpRequest 객체

    Category컴퓨터잡담 Views7463
    Read More
  3. 27
    Mar 2010
    12:51

    Prototype.js를 제대로 사용하는 방법

    Category컴퓨터잡담 Views10299
    Read More
  4. 29
    Mar 2010
    15:04

    50 개 이상의 Ajax 예제들

    Category컴퓨터잡담 Views18950
    Read More
  5. 29
    Mar 2010
    15:04

    50 개 이상의 Ajax 예제들

    Category컴퓨터잡담 Views18179
    Read More
  6. 01
    Apr 2010
    13:18

    php에서 script로 변수 전달 후 html에 div로 내용 출력하기

    Category컴퓨터잡담 Views15903
    Read More
  7. 03
    Apr 2010
    13:32

    부팅시 에러 메시지 PRESS F1 to REsume

    Category컴퓨터잡담 Views16106
    Read More
  8. 05
    Apr 2010
    16:43

    로그인 아이디 쿠키로 기억하기

    Category컴퓨터잡담 Views10966
    Read More
  9. 06
    Apr 2010
    12:25

    MySQL을 위한 하드웨어 최적화(What one can and should optimize)

    Category컴퓨터잡담 Views13123
    Read More
  10. 07
    Apr 2010
    11:28

    MYSQL my.cnf 최적화

    Category컴퓨터잡담 Views22600
    Read More
  11. 09
    Apr 2010
    07:51

    삼성, 프로그래머들에게 스마트폰 콘텐츠 개발하고 싶게 만들어라.

    Category컴퓨터잡담 Views10989
    Read More
  12. 10
    Apr 2010
    13:49

    쓸데없는 시작 프로그램을 없애자

    Category컴퓨터잡담 Views6107
    Read More
  13. 13
    Apr 2010
    17:12

    MYSQL Qcache 값 조정~~~

    Category컴퓨터잡담 Views19554
    Read More
  14. 13
    Apr 2010
    19:01

    mysql threads_created 뭐냥?

    Category컴퓨터잡담 Views12244
    Read More
  15. 14
    Apr 2010
    11:50

    svchost.exe 프로세스로 내컴퓨터 최적화 시키기

    Category컴퓨터잡담 Views7366
    Read More
  16. 14
    Apr 2010
    14:31

    MySQL 조율(튜닝)에 대해

    Category컴퓨터잡담 Views15827
    Read More
  17. 19
    Apr 2010
    09:40

    MySQL FEDERATED / InnoDB is disabled, myint64.dll 오류 어찌하오리

    Category컴퓨터잡담 Views27707
    Read More
  18. 20
    Apr 2010
    11:17

    서버에 SSD 교체 작업을 해야되나?

    Category컴퓨터잡담 Views6522
    Read More
  19. 20
    Apr 2010
    18:42

    DB MyISAM, InnoDB 입출력 처리방식

    Category컴퓨터잡담 Views13812
    Read More
  20. 21
    Apr 2010
    10:15

    블로그/사이트의 키워드 훔쳐보기^^;;

    Category컴퓨터잡담 Views9207
    Read More
Board Pagination Prev 1 ... 3 4 5 6 7 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소