If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > any rows in recordset

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-26-03, 20:26
unatratnag unatratnag is offline
Registered User
 
Join Date: Jul 2003
Location: Ohio/Chicago
Posts: 75
any rows in recordset

PHP Code:
$strSQL "select * from [post_received] where requestNumber='$D1'";
$rsD1odbc_exec$conn$strSQL); 
what do i use to check to see if any values were returned? Everything i've tried so far hasn't worked.
Reply With Quote
  #2 (permalink)  
Old 09-30-03, 16:31
moku moku is offline
Registered User
 
Join Date: Sep 2003
Location: Wisconsin, USA
Posts: 34
odbc

If your ODBC driver supports it, you can do:
$numrows = odbc_num_rows($rsD1);

However, many ODBC drivers do not return information for how many rows were in the recordset. Thus, although PHP supports it, many ODBC drivers will return -1;

I'm not sure what drivers do and don't support this. I definitely know that the Microsoft JET driver does not.


As an alternate, you can do an SQL COUNT() on your data.
Such as:
$strSQL = "SELECT COUNT(requestNumber) as theCount FROM [post_received] WHERE requestNumber = '$D1'";
$rsCount = odbc_exec($conn, $strSQL);
$rsD1Count = (int)odbc_result($rsCount, 'theCount');


from there do a if($rsD1Count > 0) {}
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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