Page 1 of 1

PHP Extension Idea

Posted: Sat Feb 25, 2012 8:54 am
by bowersbros
I've just thought. Since a majority of errors on here are things like 'mysql_result expects parameter 1 to be given' or whatever, and its usually a typo in either a field or a table name.

IS it possible for us to write a php extension that will run that check?

So, if a mysql error is encountered. It will run through the default settings of checking:

username and password are correct.

Connection is made (as above, and host is correct)

if host is incorrect (eg. locallhost is typed) then it recognises that it is actually spelt wrong, and 'assumes' that it should have been localhost, and outputs that instead.

if username or password are wrong, there isnt really a way to tell that so just standard error output of username / password incorrect.

Then get to the stuff where each mysql error has an ID, and each ID has a 'usual' problem, so we can do checks for each problem.

I think it will help alot of people, im only curious as to whether it would have a large speed issue or not.

But since we can probably get it to run only when mysql_errors occur it might not be too much of a problem.

Re: PHP Extension Idea

Posted: Sat Feb 25, 2012 9:42 pm
by jacek
I actuality started work on somethign like this a while ago.

It wasn't an extension though, it was a file you had to include.

I might get back to it actually.

Re: PHP Extension Idea

Posted: Sat Feb 25, 2012 9:50 pm
by bowersbros
Care to share current progress?

I recently fell ill in India, so have a shitload of spare time while recovering :D

Either private or public, just curious as to how far you got :D

Re: PHP Extension Idea

Posted: Sat Feb 25, 2012 9:52 pm
by jacek
Not very far, and I just looked and don't have the source any more.

It was just a custom error handler really, http://www.php.net/manual/en/function.s ... andler.php

I tried to give a bit more useful info though.