Author Topic: Improvement for framework/class.database.php  (Read 7925 times)

dito

  • Guest
Improvement for framework/class.database.php
« on: December 18, 2008, 06:54:02 PM »
 :-D Hi everybody...

I have used WebsiteBaker for a couple of websites... and I have realized that it will be helpfull an extra function in the mysql class... this class is found in framework/class.database.php

This function is "movefirst" and its very helpfull when you are looping several times through a recorset.

The function is nothing more than this:

Code: [Select]
function moveFirst() {
    if (mysql_num_rows($this->result) > 0) {
        mysql_data_seek($this->result, 0);
    }
}

this code moves the internal row pointer of the MySQL result associated with the specified result identifier to point to the specified row number. In this case the result identifier is $this->result and the specified row number is 0, therefore the function moves the internal row pointer to the first result of the recordset...

I hope this help... sorry for my english :lol:

Offline marathoner

  • Posts: 495
Re: Improvement for framework/class.database.php
« Reply #1 on: December 18, 2008, 07:39:35 PM »
I understand what this function does...but how are you using it?

Also, just a suggestion for you that you may want to consider. I've created a separate file for customized functions and then modified my root index.php to require that file. This approach keep the core functions in place and makes upgrading to future versions easier by not overwriting my custom functions.