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!
Related
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 2 years ago.
Improve this question
I want to make an online recruitment system(web) for my project in school. What are the language I need to learn except PHP. Thanks for the answer guys.
Not very proper question, you might find the answer by googling.
Anyway, You might need so far:
HTML: It will be like the skeleton of your page.
CSS: Basic knowledge would be a plus for understanding how to make it pretty.
MySQL: Unless you want a static page, you would need DB in order to save the data itself. Useful for manage cookies, sessions, users, etc.
My advice - Download some HTML free template and use it as base. Integrate it with PHP for DB connection and usage.
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!
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
Mysql extension is deprecated as of PHP 5.5.0. For sure that it will be removed in the future. However, I have thousands PHP files written many years ago in procedural instead of object oriented style. I wonder, instead of not updating the server, is there any easiest way to convert all the files with mysql extension to mysqli or pdo?
Did you say thousands of files ?
If they are working fine, I wouldn't modify the code of thousands scripts.
While it is recommended to upgrade, I suggest you to do it only when writing new code.
Every time you refactor some code, there is a risk of breaking, introducing bugs into your application.
you can try with this one: https://github.com/philip/MySQLConverterTool
here you can find some other information and another useful tools: https://wikis.oracle.com/display/mysql/Converting+to+MySQLi
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
To make things short: I'm writing an anonymous forum software with PHP. I just feel like using a database is overkill and restrains my amateur skills. Do you advise against using text files instead of database?
Thanks.
A database has advantages like some sanitation (no breaking of delimiters, newlines etc.) and less danger of access conflicts when multiple instances try to read from the table - and different from a file-based approach, writing conflicts are constrained to the record in question only.
Recommendation: use database
To make things short: Yes. Strong advise against text files.
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 9 years ago.
Improve this question
I'm working on my first opensource project, and I found useful do do an html generator class, treating the html elements as php objects, but now I don't know if it really makes sense in the real world.
Have you ever needed an html generator class for you projects?
If your answer is yes, what would you find useful on it?
If someone wants to help in the project, you are welcome to the repository on github.Github repo
Thank you.
This approach, although liked by many at first sight, always fails a reality check.
Please learn about templates - the only way to go in dealing with HTML from PHP applications.
You need them only if you are some outsourced worker from India or China. Otherwise do not use them since you have potential to ruin your career and credibility.
Those tools are built for doing very dirty code without any future prospects.