How can I build an article object

Hello Is there any way to build an article object same like built in oxarticle object generated by system?
For example I have queried through article table and traversing through the result set like this


$q="query from article table"
$rows = $db->execute($q)
while(!$rows->EOF)
{
  //is there any way that I can build an article object same as system generates using lazy loading or etc on which all system functions can be implemented like getId() and ets. I have tried some thing like $object = (object)$rows; ? I have tried this but its different 
  $rows->moveNext();
}

Please need an immediate response.:confused:
Regards,
Awais Qarni

$oArticle = oxNew(“oxarticle”);
$oArticle ->load(the oxid of the article);

[QUOTE=leofonic;83877]$oArticle = oxNew(“oxarticle”);
$oArticle ->load(the oxid of the article);[/QUOTE]
It is just returning 1
Check my code here


$oArticle = oxNew("oxarticle");
while (!$rows->EOF)
    {
        echo '<pre>';
        print_r($oArticle->load($rows->fields['OXID']));
        echo '</pre>';
    }

Its just returning 1,1,1,1…

You’re printing out the return value of the load method, not the article object.

[QUOTE=leofonic;83884]You’re printing out the return value of the load method, not the article object.[/QUOTE]
Sorry Sir, I am unable to understand your point of view. As per I have understood from your first answer the code

$article_object = $oArticle->load($rows->fields['OXID']);

will make the article object? Is it. I am printing out the same thing and getting 1. If I am wrong then what is the procedure?

The Article object ist created with oxnew(“oxarticle”). The load method loads an article into the object and returns true on success. So if you print out the return of the load method you always get “1”, which means loading was successful.


$oArticle = oxNew("oxarticle");
$oArticle ->load(the oxid of the article);
var_dump($oArticle);

Ok got it. Its working now. But I have put this code in a loop. So on every iteration of loop new object is created?
I am getting the following error when I put it in a loop?


Notice: Undefined property: object_ADOConnection::$fetchMode in D:\wamp\www\oxid_froomerce\core\adodblite\adodbSQL_drivers\mysql\mysql_meta_module.inc on line 228

You only have one object at a time. If you get performance problems, you can look how loading is done in oxarticlelist/oxlist. The error message i don’t know, maybe it is just error reporting set too high.