[PHP] Time that db´s connection is keep alive

2001-07-17 Thread Marcos Mathias

People!

Someone can tell me if PHP 4 closes their connections to the DB
automatically at the end of the script?
Or I need to use the mssql_close function each time my work is done?

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]




[PHP] select

2001-09-13 Thread Marcos Mathias

Hello !

I have a php program running under linux that conects into a Sql server 7
under win2k.
When I make a select in a table that doesn't contain any index, my select
returns no results. Otherwise, when the table contains at least one index,
the select works fine.

My question: Is that supposed to happen or i am doing something wrong?

Thanks and 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]




[PHP] select in PHP + Sql Server

2001-09-13 Thread Marcos Mathias

Hello !

I have a php program running under linux that conects into a Sql server 7
under win2k.
When I make a select in a table that doesn't contain any index, my select
returns no results. Otherwise, when the table contains at least one index,
the select works fine.

My question: Is that supposed to happen or i am doing something wrong?

Thanks and 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]




RES: [PHP] select in PHP + Sql Server

2001-09-13 Thread Marcos Mathias

Thanks.
Here is the code that i'm using:

$sql = "SELECT * FROM news";
$sql_prepare = odbc_prepare($conexao, $sql) or die ("Nao foi possivel
preparar a query.");// prepara o sql
$recordset = odbc_exec($conexao, $sql); // faz a consulta


// loop no recordset
while(odbc_fetch_row($recordset)) {
$newsid = odbc_result($recordset, 1);
$datetime = odbc_result($recordset, 2);
$source = odbc_result($recordset, 3);
echo ($newsid . "" );
echo ($datetime  . "" );
echo ($source   . "" );

}

[]s

Marcos

-Mensagem original-
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Enviada em: Thursday, September 13, 2001 6:33 AM
Para: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Assunto: Re: [PHP] select in PHP + Sql Server



You're doing something wrong!  Indexes are only for performance and
possibly they may be used for helping in ensuring uniquenes.  sorry cant be
any more help without code.




"Marcos Mathias" <[EMAIL PROTECTED]> on 13/09/2001 20:40:40

Please respond to <[EMAIL PROTECTED]>



To:   <[EMAIL PROTECTED]>
cc:
Subject:  [PHP] select in PHP + Sql Server


Hello !

I have a php program running under linux that conects into a Sql server 7
under win2k.
When I make a select in a table that doesn't contain any index, my select
returns no results. Otherwise, when the table contains at least one index,
the select works fine.

My question: Is that supposed to happen or i am doing something wrong?

Thanks and 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]








-- 
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]




[PHP] freetds problem???

2001-09-17 Thread Marcos Mathias

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]