반응형
Simply put, you need to rewrite all of your database connections and queries.
You are using mysql_*
functions which are now deprecated and will be removed from PHP in the future. So you need to start using MySQLi or PDO instead, just as the error notice warned you.
A basic example of using PDO (without error handling):
<?php
$db = new PDO('mysql:host=localhost;dbname=testdb;charset=utf8', 'username', 'password');
$result = $db->exec("INSERT INTO table(firstname, lastname) VAULES('John', 'Doe')");
$insertId = $db->lastInsertId();
?>
A basic example of using MySQLi (without error handling):
$db = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
$result = $db->query("INSERT INTO table(firstname, lastname) VAULES('John', 'Doe')");
Here's a handy little PDO tutorial to get you started. There are plenty of others, and ones about the PDO alternative, MySQLi.
반응형
'프로그래밍 > MySQL' 카테고리의 다른 글
실수로 용량이 큰 테이블에 OPTIMIZE TABLE을 실행 했을 때 (0) | 2022.11.23 |
---|---|
[MySQL] Where In & SubQuery 는 최악! JOIN & MAX & GROUP BY 사용 (0) | 2022.09.29 |
MySQL 기본적인 모니터링 방법과 Connection과 Memory 튜닝 방법 (0) | 2016.06.29 |
Running a syntax check on /etc/my.cnf (0) | 2016.06.29 |
MYSQL에서 랜덤으로 데이터 읽어오기 (0) | 2015.10.01 |