Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9160953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:51:31+00:00 2026-06-17T13:51:31+00:00

Update: Thanks for all the help guys, I’ve decided to try and write my

  • 0

Update: Thanks for all the help guys, I’ve decided to try and write my own PHP class for handling MySQL requests.

I’m faced with a problem right now when I’m trying to make the switch from mysql_ to mysqli_ functions, in that I have literally tens of thousands of lines of PHP/MySQL code and queries scattered across hundreds of files, and they’re all using functions such as mysql_query, mysql_num_rows, mysql_fetch_assoc, etc. Going through and changing these line by line (even with find/replace) to mysqli_ functions with prepared statements and all is pain enough, but what if in the future PHP.net decides to release something else that will deprecate the mysqli_ functions?

So right now I’m considering perhaps writing my own MySQL library (is that what you would call it?) that calls the mysqli_ functions and including it in all my files. This way, if I needed to change something else in the future, theoretically I could change the function in my “library” once and changes would be reflected on all pages, instead of manually going through and changing everything by hand.

Would this be a good idea? I found something online called MeekroDB, but first of all I’m not sure if it’s what I’m looking for and second of all they’re charging $50 to use this commercially (which I want to do.) Are there other free solutions, or would I just be wasting my time?

Any comments/feedback is appreciated 🙂

Edit: In case this wasn’t clear, it’s not as if I’m making a connection to my database in every file that I’m making queries to database. I have a functions.php file that I use to connect to the MySQL database and I include that file in all my other files. My question is more related to functions such as mysql_query, mysql_num_rows, and mysql_fetch_assoc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:51:32+00:00Added an answer on June 17, 2026 at 1:51 pm

    From looking at your referenced link to MeekroDB, I don’t think what you’re writing is a MySQL API like the mysql_*/mysqli_* methods.

    What you’re in fact looking to write is a Database Abstraction Layer, despite it being specific to MySQL.

    The fact is, unless you’re going to write your own underlying module to communicate with MySQL (of course, you could also do this with difficulty in PHP), you’re probably going to end up using the mysqli_ methods as a backing anyway.

    There are many of these layers available, but I’d honestly consider using PDO over writing your own, or using mysqli_* if you’re worried about functions being deprecated. PDO uses its own MySQL driver, and so will be updated if it needs to be. It also supports all what you’d require including easy-to-use transactions, prepared statements and whatnot.

    If you wanted to create your own easy-access methods such as DB::Query(..), you can do this by wrapping PDO easy enough.

    Overall, though, I don’t see how this is going to help with organising your code. You’re probably going to want to look into something like an ORM (Object Relationship Mapper) to your DB where you can define your own classes that map straight into tables, which should alleviate the need of running queries almost entirely, apart from edge cases. The most comprehensive ORM available would probably be Doctrine, although you can quite easily write your own by again, wrapping PDO.

    Just as an example of what you could achieve by using an ORM, here’s a snippet of code to demonstrate:

    $blogPost = BlogPosts::Load(123);
    $blogPost->title = 'New Title';
    $blogPost->save();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE: Thanks for all your help guys! I just need to take a litte
Update Thanks to Marc's help the AlphaPagedList class is now available on CodePlex if
Hi Guys thanks for all the help on things. Im using linq and im
Update: Thanks guys, I didn't realize it was very close to zero but not
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
update: I mistyped 2 variables...so embarrassing. thanks everyone for the effort! sorry i find
Update: I reported this as a bug to Apple and they fixed it! All
I have managed finally to get Solr working, with the help of all you
Nice quick one for you guys, hope you can help. After a dodgy CMS
Update: Is there a way to achieve what I'm trying to do in an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.