You are here: EOF messes up recordset « PHP SQL « IT news, forums, messages
EOF messes up recordset

Posted by Dieter Beheydt on 09/29/64 11:21

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 ?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация