Skip to Content.
Sympa Menu

freetds - Error in select using Freetds

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Marcos" <mmathias AT vento.com.br>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Error in select using Freetds
  • Date: Thu, 13 Sep 2001 17:20:53 -0400


Hello !

I have a php program running under linux Suse 7.1 and Apache 1.3.19 that
connects into a Sql server 7 under win2k using the freetds and iodbc 3.0.5
to connect.

I'm having some problems that i could not understand. I hope someone can
help me.

When I make a select using (* example "select * from table") in a table
that doesn't contain any index, my select returns no results. And the page
show no errors too.
EX:
//***********************************
$sql = "SELECT * FROM table";
$sql_prepare = odbc_prepare($conexao, $sql) or die ("Não foi possível
preparar a query.");
$recordset = odbc_exec($conexao, $sql);
while(odbc_fetch_row($recordset)) {
$Name = odbc_result($recordset, 1);
$LastName = odbc_result($recordset, 2);
}
THE CODE ABOVE DOES NOT WORK
//***********************************


When i specify the fiels I want, (example "select name, lastname from
table", the select only works if I get at the latest 10º field. The last
registrys don't appear and the page stays blank.
//***********************************
$sql = "SELECT Name, LastName FROM table";
$sql_prepare = odbc_prepare($conexao, $sql) or die ("Não foi possível
preparar a query.");
$recordset = odbc_exec($conexao, $sql);
while(odbc_fetch_row($recordset)) {
$Name = odbc_result($recordset, 1);
$LastName = odbc_result($recordset, 2);
}
// THIS CODE WORKS FINE
//***********************************


//***********************************
$sql = "SELECT field1, field2, field3, field4, field5, field6, field7,
field8, field9, field10, field11 FROM table";
$sql_prepare = odbc_prepare($conexao, $sql) or die ("Não foi possível
preparar a query.");
$recordset = odbc_exec($conexao, $sql);
while(odbc_fetch_row($recordset)) {
$field1 = odbc_result($recordset, 1);
$field2 = odbc_result($recordset, 2);
$field3 = odbc_result($recordset, 3);
$field4 = odbc_result($recordset, 4);
$field5 = odbc_result($recordset, 5);
$field6 = odbc_result($recordset, 6);
$field7 = odbc_result($recordset, 7);
$field8 = odbc_result($recordset, 8);
$field9 = odbc_result($recordset, 9);
$field10 = odbc_result($recordset, 10);
$field11 = odbc_result($recordset, 11);
}
// THIS CODE DOES NOT WORK
//***********************************


Otherwise, when the table contains at least one index, any kind of the
selects above works just fine.
I think that error could be caused by the freetds.

If i don't make myself clear, please email me at mmathias AT vento.com.br
Thank you very muck.

Best Regards!

Marcos Mathias
mmathias AT vento.com.br



  • Error in select using Freetds, Marcos, 09/13/2001

Archive powered by MHonArc 2.6.24.

Top of Page