Hey Everyone!
I have a question about oop. I am trying to write a MySQL class for managing my MySQL db's and calls. So far I have almost completed it, but I am missing lots of functions. These are the result functions (ie. mysql_fetch_array() or mysql_num_rows() etc.). Instead of creating a function in my class to handle each of these I would like to be able to call my class like $mysql->fetch_array($result) and have that translate to mysql_fetch_array() within my class. The only way I see of doing this would be to create a function that handles invalid function calls for my class. Then using an if statement, see if the invalid function call was to a mysql function and then send it to that. Does this sound possible. If not, might there be another way to do this?
Thanks,
FlashCreations

Recommended Answers

All 3 Replies

What you're describing sounds like you're looking for something like the __call() magic method

That would be exactly what i was looking for! Thanks.
(And a side note, I actually was looking through PHP.net's Class reference and came across that page. I just didn't scroll down far enough!)

Excellent glad i could be of assistance.
Don't forget to mark the thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.