Change mysql code to PDO [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
but i have this project for school,
i need to make a blog with a database connection.
I have one using mysqli but we are only allowed to use PDO, and in don't know how i can convert it in to PDO can someone help me?

A good link for you : Migrate from mysql extension to pdo
And take the time to read the PDO manual here : http://php.net/manual/fr/book.pdo.php
Sorry but, I cant give you more specific information if you dont share us the code that gives you trouble.

Related

I need to convert codeigniter with mongodb to codeigniter and pdo or mysqli [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have one project that is made in codeigniter and mongodb ... I need that project to be converted to codeigniter with pdo or mysqli. it is working with mongodb but i am not getting which files should be replace or what configuration needs to be reverted.
Can someone help regarding file structures
Thanks
Regards
You need to modify the config/Database.php and select the 'dbdriver' => 'mysqli' and make the relevant connection change like hostname, username, database, etc

What is the best method to connect to a database in php? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am relatively new to php and I need to connect to a database using php, as i understand there are several methods of connecting to a database, what is the most current method of doing this?
If you are going to use built-in PHP methods, I would advise using PHP PDO. You can find more information on PDO here. You can also use a separate package to manage connections for you such as Doctrine, though this can get a little more complex in the setup. If you are just getting started in PHP, it may be easier to start off with PDO. I hope this helps!

Why use Mongodb instead of MySql [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I want to know that why use Mongodb over MySql. Anyone who have experience in Mongodb or on MySQl please suggest me.
You need to decide if you need the "transactional" capabilities or SQL or the document (or object orient) data store functionality of MongoDB. It is really a very lengthy and subjective discussion, not really best suited for here.

Can i use mysql databases from some other websites for my site? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Can u tell me, can i use database from this server www.serversfree.com for my own website?
I googled but couldn't find anything ..
Thanks all
Yes, if you are allowing in your database to access from outside. If you are behind firewall, you need to set up portforward. But i do not recommend this.
Instead to directly access your database from outside your server, let's write an API, use API key and security tokens to perform actions on your DB.

what is the diffrence between php api to connect mysql? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm currently using mysql_query() to approach DB.
I understand that this method will be removed in the future so I want to learn a new api.
What in your opinion is the best way and why? PDO or mysqli? or there is another one I haven't heard about?
Thank you.
I'm going to offer what I consider to be the best way to handle database stuff: Build your own class. In my case, this class just wraps mysql_* functions, however if I wanted to it would be really easy to change to a different one (such as if mysql_* gets removed). I only have to change a single file, and instantly the entire project is using a new API.
Believe me, do this right at the start and you will save yourself a LOT of work if and when you decide to change things around!

Categories