[eluser]Mark Middleton[/eluser]
Hi there
I've got a class that I'm trying to get working within CI, and it has it's own connection to the (mysql) DB and such.
I assume the "best" form would be to convert every reference to a DB call to the DB helper functions.
Would it be possible to make a tweak or two in the current class file to get it to work without re-writing all of the DB calls? (I am using MySQL)
Here's the error I get:
Quote:A PHP Error was encountered
Severity: Warning
Message: mysql_query(): supplied argument is not a valid MySQL-Link resource
Here's a snippet of the code:
Code:
<PHP
class Mptt {
function mptt($link = null)
{
$this->link = $link;
return true;
}
function add($parent, $child_num = 0, $misc_data = false)
{
if(!is_numeric($parent) || $parent < 0)
{
....
$result = mysql_query($sql, $this->link) or die(mysql_error() . "<br>\nSQL<br>\n" . $sql);
if(mysql_num_rows($result) != 1)
{ // Row must exist.
return false;
}
$parent = mysql_fetch_assoc($result);
mysql_free_result($result);
... and so on ...
Thanks for taking a look,
-Mark