odbc_exec is returning blank entries in the resource id

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dumlee
Forum Commoner
Posts: 33
Joined: Mon Jun 30, 2008 12:06 am

odbc_exec is returning blank entries in the resource id

Post by dumlee »

Hi,

I am using following code to connect with mssql server using php :

for($i = 0;$i<count($postidarray);$i++){
$query1 = "SELECT * FROM tblsi_socialposts where postid = ".$postidarray[$i];
$result1 = odbc_exec($conn,$query1);
$colNumber1 = odbc_num_fields($result1);
}
When I echo $colNumber1 then it returns following output :
4

4

4

4
4
4
4
4
4
4
& so on.
Now you might have noticed that num ber 4 is number of columns and for first few entries there is a gap coming and after some records the sequence is correct. This gap is making my new array index to even numbers for first few entries.

Please give solution for this. Why these blank entries are being shown ?

Thanks.
Post Reply