CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Reset Record Pointer To First Record

Print topic Send  topic

Author Message
maxhugen

Posts: 272
Posted: 09/24/2008, 7:54 AM

As a continuation of this topic (which seems closed) :

http://forums.codecharge.com/posts.php?post_id=90533

I too would like to know how to get the pointer back to the first record of a clsDBConnection object.

I'm using a second connection ($db2) to get checkbox values for a Directory webpage. I have to loop through the $db2 result set in the BeforeSubcategoryShow event to see if there's a match... so the loop needs to run on the same $db2 result set for each subcategory in the Directory.

Any suggestions on resetting the pointer would be very helpful!

MTIA


_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com
View profile  Send private message
mentecky

Posts: 321
Posted: 09/24/2008, 10:39 AM

maxhugen,

Have you tried:
$db2->seek(0);

Rick
_________________
http://www.ccselite.com
View profile  Send private message
maxhugen

Posts: 272
Posted: 09/24/2008, 4:55 PM

Thanks Richard, but that didn't work.

I checked the CCS manual page at 'Connection Reference', and find that method is not listed.
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com
View profile  Send private message
mentecky

Posts: 321
Posted: 09/24/2008, 6:38 PM

maxhugen,

I FOUND IT!!!!

The DB class has a var called Auto_Free that you have to set to false. You also have to close your DB manually (I believe). Here's some code I wrote to test it.

    $db = new clsDBcommunity();  
  
	// Don't automatically free the DB!!!  
	$db->Auto_Free = false;  
  
    $SQL = "SELECT * FROM user_groups";  
  
	$db->query($SQL);  
  
	$html = "Initial Query:<br>";  
  
	$result = $db->next_record();  
  
	while ($result)  
	{  
	   $html.= $db->f("group_name")."<br>";  
	   $result = $db->next_record();  
	}  
  
	$html .= "<p>After Reset:<br>";  
  
	$db->seek(0);  
	$result = $db->next_record();  
  
	while ($result)  
	{  
	   $html.= $db->f("group_name")."<br>";  
	   $result = $db->next_record();  
	}  
      
	$db->close();  
  
	$Label1->SetValue($html);  

You can see the code work at a test page I created on the CCSElite site here:
http://www.ccselite.com/test_seek.php

Good Luck!

Rick
_________________
http://www.ccselite.com
View profile  Send private message
mentecky

Posts: 321
Posted: 09/24/2008, 6:45 PM

maxhugen,

Note I change the code above a bit from the original post so use the code above and not the code in your email if you got one.

Rick
_________________
http://www.ccselite.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.