Connecting Tech Pros Worldwide Help | Site Map

recordset gets messed up by EOF/ reading in it ?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 02:15 PM
Dieter Beheydt
Guest
 
Posts: n/a
Default recordset gets messed up by EOF/ reading in it ?

Seems like a $rs-> EOF messes up the record set ?
(using php 4.2.2 and MSSQL database)
I try to read the ntext-field "body".



THIS WORKS !!

$dbMail = new COM("ADODB.Connection");
$dsn = "DRIVER={SQL Server}; SERVER={--------};UID={-----};PWD={-------};
DATABASE={--------}";
$dbMail->Open($dsn);

$sql="select * from email INNER JOIN klassement ON email.id =
klassement.mailid where email.id = '124' ORDER BY date_sent DESC";
$rs=$dbMail->Execute($sql);

$thebody=$rs->Fields["body"]->Value;
echo $thebody;



THIS PRINTS A ZERO ?????


$dbMail = new COM("ADODB.Connection");
$dsn = "DRIVER={SQL Server}; SERVER={--------};UID={-----};PWD={-------};
DATABASE={--------}";
$dbMail->Open($dsn);

$sql="select * from email INNER JOIN klassement ON email.id =
klassement.mailid where email.id = '124' ORDER BY date_sent DESC";
$rs=$dbMail->Execute($sql);
while(!$rs->EOF)
{
$thebody=$rs->Fields["body"]->Value;
echo $thebody;
$rs->MoveNext();
}
$rs->Close();




How is this possible???



Also I see now that in the first case, if I try to echo twice the same , it
doesn't print the second one:

echo $rs->Fields["body"]->Value; // prints the text
echo $rs->Fields["body"]->Value; // prints nothing (even no zero)


anyone ?








 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.