-5

I saw this post, saying that you must not use the mysql_* functions. How can I then use functions like: mysql_query(), mysql_connect() or mysql_real_escape_string() without the MySQL extension(mysql_*)?

Can I do this without PDO, because this questions ask the same, but with PDO

3
  • there is mysqli extension, php.net/manual/en/book.mysqli.php Commented Dec 6, 2013 at 16:19
  • The whole point of that post is that you shouldn't be using these functions. Your question doesn't make sense. Commented Dec 6, 2013 at 16:21
  • Your question is answered in the post you referred to. There's an answer that describes all the different extensions that can be used to query MySQL. Commented Dec 6, 2013 at 16:24

1 Answer 1

0

The answer to your question is the following: Utilize the mysqli API as opposed to the mysql API https://www.php.net/mysqli

There is a bit of learning involved because the functions don't behave exactly the same, but it's for the better.

For example, instead of using mysql_connect() to get your connection you would use https://www.php.net/manual/en/mysqli.construct.php

Additionally, please follow these steps to make sure you have access to mysqli and PDO, as it's going to vary based on how you installed php https://www.php.net/manual/en/mysqli.installation.php

So, in summary, what that post you've pointed out is saying is that functions starting with mysql_ are deprecated and to not use them anymore.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.