Hey people! Someone can help a newbie in php please??

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 [EMAIL PROTECTED]
Thank you very muck.

Best Regards!

Marcos Mathias


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to