Quote:
Originally Posted by HolyKiller
Fine mod, but i get one Warning if i giving avard to some user.
Code:
Warning: mysql_insert_id() [function.mysql-insert-id]: A link to the server could not be established in [path]/adminpanel/award.php on line 581
Award is given, PM sended, everything looks fine, but that messages... i don't know what is wrong.
Thanks
Holy
|
The problem is in the mod source. The author "hardcoded" usage of (now deprecated, but that's not the point) mysql_insert_id(). But vB can use both mysql and mysqli API. And when you switch vB to new mysqli API, the problem appears:
- mysql_insert_id() is called without parameters, so it's supposed to take last opened mysql connection (opened from "old" mysql api)
- but there is no mysql connection, all connetions were opened by mysqli api
- "no worries!", says php, "we make new connections", so it tooks db credentials from php.ini and tries to make new connection
- but credentials in php.ini are usually empty, therefore the connection fails and mysql_insert_id() fails with it
Solution? I don't want to be rude, but hardcoding 1 api when vB is capable of running of 2 different APIs isn't the cleanest way. The cleanest way would be to use vB's build-in class and call some *insert_id() wrapped (if exists) or to dig the mysql(i) link object from vB's classes and use it directly in consideration of selected mysql API in vB conf. Or perhaps something better

There are always many solutions to those kinds of problems.
But it's nice mod, anyway