Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
SeeTurtle-team
WebServerPrograming_Project
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
WebServerPrograming_Project
/
json_demo_db.php
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
23 lines (23 loc) · 1.14 KB
main
Breadcrumbs
WebServerPrograming_Project
/
json_demo_db.php
Copy path
Top
File metadata and controls
Code
Blame
23 lines (23 loc) · 1.14 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
session_start();
$seq = $_SESSION['seq'];
header("Content-Type: application/json; charset=UTF-8");
//해더("내용 유형 : json형식의 응용프로그램; 문자 UTF-8 인코딩");
$obj = json_decode($_GET["content"], false);
//obj는 json형식 디코드(x정보 얻기, false로 해야 화면에 값을 표시해줍니다.);
//(디코딩이란 부호화된 데이터를 부호화되기 전으로 되돌림을 말함)
$conn = mysqli_connect("database-1.c9g35ixldt8h.ap-northeast-2.rds.amazonaws.com", "admin", "00000000", "project");
//conn은 mysqli에 접속한다. (localhost경로, 사용자 아이디, 비밀번호, db이름);
mysqli_query ($conn, 'SET NAMES utf8');
//mysqli_query utf8 셋팅
$stmt = $conn->prepare("SELECT * FROM $obj->table where seq='$seq'");
//DB쿼리문 입력(tableforchat 테이블에 담긴 정보를 불러옴)
$stmt->execute();
//stmt 실행
$result = $stmt->get_result();
//stmt로부터 결과값 얻고, result에 저장
$outp = $result->fetch_all(MYSQLI_ASSOC);
//출력 = 결과값을 한 행식 패치해서 담음
echo json_encode($outp);
//json 인코드(outp). echo는 하나 이상의 문자열을 출력한다.
?>
You can’t perform that action at this time.