473,322 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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 ?



Jul 17 '05 #1
0 1195

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: ANC | last post by:
hi, i would like to ask how can i set a field of recordset to be editable? thanks in advance. ANC
8
by: dmiller23462 | last post by:
My brain is nuked....Can anybody tell me right off the bat what is wrong with this code? Along with any glaring errors, please let me know the syntax to display a message (Response.Write would be...
4
by: sci | last post by:
Could someone help me by answering the questions below? What's a cursor? What's difference between Query and View? Is a RecordSet just part of a table? Can it be part of a query of view? If...
7
by: Peter Bailey | last post by:
I have a querystring built up in vba and I want to open a recordset based on the sql and pass the date value to a textbox or label for use elsewhere on the form. The recordset isnt working as it...
6
by: lenny | last post by:
Hi, I've been trying to use a Sub or Function in VBA to connect to a database, make a query and return the recordset that results from the query. The connection to the database and the query...
0
by: sienayr | last post by:
Greetings, I have searched hi and lo through the groups and haven't found my problem specifically. I have listed below what I have tried based on what I have found in the groups. Please let me...
2
by: Jim M | last post by:
I rarely deal with recordsets directly with code, since I usually use Access queries, so be patient with this question. I want to open a recordset with various default variables used by my program....
23
by: PW | last post by:
Hi, I'd like to close a recordset and set the database to nothing if a recordset is open if an error has occured. Leaving a recordset open and a database open isn't a good idea, right? ...
4
by: Joseph | last post by:
Hi all- I am a former VB6 programmer and new at C# and I have a question dealing with converting some code from VB6 to C#. The code is below and essentially, what it does is gets data from a SQL...
1
by: RogerThis | last post by:
I have basically the same problem... (and I'm a Newbie). I have a sub-form that is being filtered based on the combo boxes available. The underlying query is straight forward for most selections......
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.