P
P
pashulke2015-02-09 14:46:00
PHP
pashulke, 2015-02-09 14:46:00

Why can't mysql_*() and the like be used?

Actually, the question is in the title. And what is better to use instead?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
F
FanatPHP, 2015-02-09
@pashulke

You can use. But not recommended.
There are two reasons:
What to use instead, in descending order of preference:

  1. ORM and QueryBuilder from the framework you use, like laravel.com/docs/4.2/eloquent
  2. Normal wrapper with placeholder support, such as phpfaq.ru/safemysql
  3. If you absolutely can’t give up the habit of working directly with API functions, then PDO, phpfaq.ru/pdo

A
Alexey Yakhnenko, 2015-02-09
@ayahnenko

php.net/manual/en/function.mysql-connect.php
Warning
This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:
mysqli_connect()
PDO::__construct()

S
Stanislav, 2015-02-09
@mzcoding

Outdated. Removed in php 5.5 and above. Learn PDO.

K
KIN1991, 2015-02-10
@KIN1991

because the guys from habr will stop respecting

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question