Re: [PHP-DB] php + mysql + copy file

2008-04-02 Thread Chris



 $carpeta = "subidos"; // nombre de la carpeta ya creada. chmool 777
(todos los permisos)

 copy($_FILES['file']['tmp_name'] , $carpeta . '/' . $_FILE
['file']['name']);


It's $_FILES not $_FILE (an 's' on the end).

It's always worth using error_reporting(E_ALL) and 
ini_set('display_errors', true) when doing development, this would have 
triggered a notice or warning (can't remember which).


--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] php + mysql + copy file

2008-04-02 Thread Emiliano Boragina
Hello

I have the next code:

 

-- archive_a_subir.php --



 

 



 

In archive_subir.php:

 



 

You can see this in http://www.portbora.com.ar/foro/archivo_a_subir.php,
when I run these appears the next warning

 

Warning: copy(subidos/) [ 
function.copy]: failed to open stream: Is a directory in
/home/pu000561/public_html/foro/archivo_subir.php on line 3

 

Why this? How can I run correctly?

Thanks.

 

+  _
   // Emiliano Boragina _

   // Diseño & Comunicación //
+  _

   // [EMAIL PROTECTED]  /
   // 15 40 58 60 02 ///
+  _

 



Re: [PHP-DB] Problem when using SQL_CUR_USE_ODBC on connect

2008-04-02 Thread cfs
The mssql driver uses a dll that has a limitation on varchar fields of 255 
characters. And the 30 chracter column name limit. And after SQL 2005, may 
not be supported at all.

So that alt has been tried, and then adandoned.

""Jon L."" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> (This isn't a solution, per se...just a suggestion.)
>
> I don't know how they compare; I've never personally used the ODBC
> functions...
>
> But, you may give the MSSQL functions a try:
> http://php.net/mssql
>
> - Jon L.
>
> On Mon, Mar 31, 2008 at 3:27 PM, cfs <[EMAIL PROTECTED]> wrote:
>
>> I'm using PHP with Apache. PHP code connects to MS SQL server using ODBC.
>>
>> I'm doing a query against a table that is very simple: one column of the
>> real data type, one of the text data type.
>>
>> The text field is set to "testing 1,2,3". The real column is set to
>> 10.015.
>>
>> When I use the default connect options, I get both values back fine.
>>
>> When I use  SQL_CUR_USE_ODBC, which I very much want to use, then the 
>> text
>> column data comes back as boolean(false).
>>
>> Does anyone know of a solution?
>>
>> Table:
>>
>> CREATE TABLE [dbo].[test1](
>> [ID] [int] IDENTITY(1,1) NOT NULL,
>>
>> [real1] [real] NULL,
>>
>> [text1] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
>>
>> CONSTRAINT [PK_test1] PRIMARY KEY CLUSTERED
>>
>> (
>>
>> [ID] ASC
>>
>> )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
>>
>> ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
>>
>> Code:
>>
>> > $conn = odbc_connect(db-name, user-name,password, SQL_CUR_USE_ODBC);
>> $result = odbc_exec($conn, "select * from test1");
>> if (odbc_fetch_row($result)) {
>>  print "Values: " . odbc_result($result,"real1") . "," .
>> odbc_result($result,"text1");
>> }
>> ?>
>>
>>
>>
>>
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mssql_connect error only on command line

2008-04-02 Thread Krister Karlström

Hi again!

Allright, great! You see that user manuals can be very useful if they 
just are read carefully enough! :)


The user contributions to the PHP manual are very often quite 
informative and it's great that people document the problems and solutions.


I think you're quite near the truth here about the version thing and how 
CLI and Apache loads the dll:s. Maybe that's something that can be 
configured, but you probably made the best solution to replace the old file.


Cheers,
Krister Karlström, Helsinki, Finland

Molteni Davide wrote:


Hi,

I red the http://www.php.net/manual/en/function.mssql-connect.php in a more
accurate manner, and I found an user contribution note suggesting to substitute
the ntwdblib.dll with a newer one.
The version of the old (original from the PHP v5.2.5 installation) is
2000.2.8.0
and the newer version I found on the same machine is 2000.80.2039.0.
Now it works fine.

Maybe the differt behaviour between the php CLI (command line interface) and
apache is that the cli search the dll in the installation folder and apache
search in the windows system folder.

Thanks for the big help.

Regards.

Davide


2008/4/2, Krister Karlström <[EMAIL PROTECTED]>:

Hi!

Please have a look at the manual pages (if you have not allready done
that). There might be some information for you in the user comments:

http://www.php.net/manual/en/function.mssql-connect.php

Manual page about command line scripting:

http://www.php.net/manual/en/features.commandline.php

Now you're using windows so I don't think that FreeTDS is used, right? But
if you were on a Linux environment you should note that you need to have the
server configured in the config file for FreeTDS, exactly in the same way
your connecting. That means if you use fully qualified domain names the
server should be registered with the same hostname in freetds.conf. But that
has probably nothing to do with this now since you're using Windows...

The documentation of mssql_connect() says that you can specify a
portnumber like you did, but I found some examples on the net using a colon
(:) instead. Try that also, or try with the default port number... I'm not
sure if that is gonna help you at all, but it's worth trying...

Or maybe you have some problem with name resolution through DNS... Try
using the IP adress when connecting... It's really hard to tell what's
wrong. However, I have seldom used PHP in a Windows environment so maybe I'm
the wrong person to answer your questions! :) I do however have a command
line application running on Windows XP that successfully uses MySQL on a
Linux server, never had any trouble with that...

Greetings,
Krister Karlström, Helsinki, Finland

Molteni Davide wrote:

Hi,

thanks for your quick answer,

but in the script I don't use sessions variables to store host, user and
password, I wrote something like that:
$sc=mssql_connect("hostname,1433","userid","password");

Can you please tell me where I can find information about how to design
scripts for either the environment?

Thanks a lot.

Davide

2008/4/2, Krister Karlström <[EMAIL PROTECTED]>:


Hi!

That description did not help us very much... I think you're just
connecting using the wrong credentials, or using no at all. From where
do
you grab the hostname, username and password? Maybe it's stored in
your
session or something, and that session is not working in your command
line
environment..? It could be just about anything that's your problem! :)

My advice is to take a look att the parameters using to connect to the
server, maybe echo them to stdout before doing your connect... It
might be
that they are not defined when running your script on command-line.

In general, very few script are written in such a way that they work
the
same way in a webserver environment and on command line. You should
design
your scripts for either the environment.

Greetings,
Krister Karlström, Helsinki, Finland

Molteni Davide wrote:

 Hi,


I have a problem with all my php scripts that use MS SQL Server, but
only
when I start them from the command line
I'm using Apache 2.2.4 with PHP 5.2.5 on a server Win2k3 with SP2,
and
MS
SQL Server 2000 on another Win2k3 server.
If I run the same script using a webbrower as an internet page it
works
fine,
but if I run it from the command line (c:\>php scipt.php) I will
receive
messages like this:
"Warning: mssql_connect(): Unable to connect to server:
servername,1433
in
c:\script.php on line #"
Can someone have an idea what could be the problem?
Can someone please help me?
What should I do to make it working?
Tanks a lot in advance.

Davide










--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mssql_connect error only on command line

2008-04-02 Thread Molteni Davide
Hi,

I red the http://www.php.net/manual/en/function.mssql-connect.php in a more
accurate manner, and I found an user contribution note suggesting to substitute
the ntwdblib.dll with a newer one.
The version of the old (original from the PHP v5.2.5 installation) is
2000.2.8.0
and the newer version I found on the same machine is 2000.80.2039.0.
Now it works fine.

Maybe the differt behaviour between the php CLI (command line interface) and
apache is that the cli search the dll in the installation folder and apache
search in the windows system folder.

Thanks for the big help.

Regards.

Davide


2008/4/2, Krister Karlström <[EMAIL PROTECTED]>:
>
> Hi!
>
> Please have a look at the manual pages (if you have not allready done
> that). There might be some information for you in the user comments:
>
> http://www.php.net/manual/en/function.mssql-connect.php
>
> Manual page about command line scripting:
>
> http://www.php.net/manual/en/features.commandline.php
>
> Now you're using windows so I don't think that FreeTDS is used, right? But
> if you were on a Linux environment you should note that you need to have the
> server configured in the config file for FreeTDS, exactly in the same way
> your connecting. That means if you use fully qualified domain names the
> server should be registered with the same hostname in freetds.conf. But that
> has probably nothing to do with this now since you're using Windows...
>
> The documentation of mssql_connect() says that you can specify a
> portnumber like you did, but I found some examples on the net using a colon
> (:) instead. Try that also, or try with the default port number... I'm not
> sure if that is gonna help you at all, but it's worth trying...
>
> Or maybe you have some problem with name resolution through DNS... Try
> using the IP adress when connecting... It's really hard to tell what's
> wrong. However, I have seldom used PHP in a Windows environment so maybe I'm
> the wrong person to answer your questions! :) I do however have a command
> line application running on Windows XP that successfully uses MySQL on a
> Linux server, never had any trouble with that...
>
> Greetings,
> Krister Karlström, Helsinki, Finland
>
> Molteni Davide wrote:
>
> Hi,
> >
> > thanks for your quick answer,
> >
> > but in the script I don't use sessions variables to store host, user and
> > password, I wrote something like that:
> > $sc=mssql_connect("hostname,1433","userid","password");
> >
> > Can you please tell me where I can find information about how to design
> > scripts for either the environment?
> >
> > Thanks a lot.
> >
> > Davide
> >
> > 2008/4/2, Krister Karlström <[EMAIL PROTECTED]>:
> >
> > > Hi!
> > >
> > > That description did not help us very much... I think you're just
> > > connecting using the wrong credentials, or using no at all. From where
> > > do
> > > you grab the hostname, username and password? Maybe it's stored in
> > > your
> > > session or something, and that session is not working in your command
> > > line
> > > environment..? It could be just about anything that's your problem! :)
> > >
> > > My advice is to take a look att the parameters using to connect to the
> > > server, maybe echo them to stdout before doing your connect... It
> > > might be
> > > that they are not defined when running your script on command-line.
> > >
> > > In general, very few script are written in such a way that they work
> > > the
> > > same way in a webserver environment and on command line. You should
> > > design
> > > your scripts for either the environment.
> > >
> > > Greetings,
> > > Krister Karlström, Helsinki, Finland
> > >
> > > Molteni Davide wrote:
> > >
> > >  Hi,
> > >
> > > > I have a problem with all my php scripts that use MS SQL Server, but
> > > > only
> > > > when I start them from the command line
> > > > I'm using Apache 2.2.4 with PHP 5.2.5 on a server Win2k3 with SP2,
> > > > and
> > > > MS
> > > > SQL Server 2000 on another Win2k3 server.
> > > > If I run the same script using a webbrower as an internet page it
> > > > works
> > > > fine,
> > > > but if I run it from the command line (c:\>php scipt.php) I will
> > > > receive
> > > > messages like this:
> > > > "Warning: mssql_connect(): Unable to connect to server:
> > > > servername,1433
> > > > in
> > > > c:\script.php on line #"
> > > > Can someone have an idea what could be the problem?
> > > > Can someone please help me?
> > > > What should I do to make it working?
> > > > Tanks a lot in advance.
> > > >
> > > > Davide
> > > >
> > > >
> > > >
> >
> >


-- 
Davide Molteni
alla Stazione
6702 Claro
Tel. 091 630 1710
Nat. 076 381 3281


Re: [PHP-DB] mssql_connect error only on command line

2008-04-02 Thread Krister Karlström

Hi!

Please have a look at the manual pages (if you have not allready done 
that). There might be some information for you in the user comments:


http://www.php.net/manual/en/function.mssql-connect.php

Manual page about command line scripting:

http://www.php.net/manual/en/features.commandline.php

Now you're using windows so I don't think that FreeTDS is used, right? 
But if you were on a Linux environment you should note that you need to 
have the server configured in the config file for FreeTDS, exactly in 
the same way your connecting. That means if you use fully qualified 
domain names the server should be registered with the same hostname in 
freetds.conf. But that has probably nothing to do with this now since 
you're using Windows...


The documentation of mssql_connect() says that you can specify a 
portnumber like you did, but I found some examples on the net using a 
colon (:) instead. Try that also, or try with the default port number... 
I'm not sure if that is gonna help you at all, but it's worth trying...


Or maybe you have some problem with name resolution through DNS... Try 
using the IP adress when connecting... It's really hard to tell what's 
wrong. However, I have seldom used PHP in a Windows environment so maybe 
I'm the wrong person to answer your questions! :) I do however have a 
command line application running on Windows XP that successfully uses 
MySQL on a Linux server, never had any trouble with that...


Greetings,
Krister Karlström, Helsinki, Finland

Molteni Davide wrote:


Hi,

thanks for your quick answer,

but in the script I don't use sessions variables to store host, user and
password, I wrote something like that:
$sc=mssql_connect("hostname,1433","userid","password");

Can you please tell me where I can find information about how to design
scripts for either the environment?

Thanks a lot.

Davide

2008/4/2, Krister Karlström <[EMAIL PROTECTED]>:

Hi!

That description did not help us very much... I think you're just
connecting using the wrong credentials, or using no at all. From where do
you grab the hostname, username and password? Maybe it's stored in your
session or something, and that session is not working in your command line
environment..? It could be just about anything that's your problem! :)

My advice is to take a look att the parameters using to connect to the
server, maybe echo them to stdout before doing your connect... It might be
that they are not defined when running your script on command-line.

In general, very few script are written in such a way that they work the
same way in a webserver environment and on command line. You should design
your scripts for either the environment.

Greetings,
Krister Karlström, Helsinki, Finland

Molteni Davide wrote:

 Hi,

I have a problem with all my php scripts that use MS SQL Server, but
only
when I start them from the command line
I'm using Apache 2.2.4 with PHP 5.2.5 on a server Win2k3 with SP2, and
MS
SQL Server 2000 on another Win2k3 server.
If I run the same script using a webbrower as an internet page it works
fine,
but if I run it from the command line (c:\>php scipt.php) I will receive
messages like this:
"Warning: mssql_connect(): Unable to connect to server: servername,1433
in
c:\script.php on line #"
Can someone have an idea what could be the problem?
Can someone please help me?
What should I do to make it working?
Tanks a lot in advance.

Davide







--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mssql_connect error only on command line

2008-04-02 Thread Molteni Davide
Hi,

thanks for your quick answer,

but in the script I don't use sessions variables to store host, user and
password, I wrote something like that:
$sc=mssql_connect("hostname,1433","userid","password");

Can you please tell me where I can find information about how to design
scripts for either the environment?

Thanks a lot.

Davide

2008/4/2, Krister Karlström <[EMAIL PROTECTED]>:
>
> Hi!
>
> That description did not help us very much... I think you're just
> connecting using the wrong credentials, or using no at all. From where do
> you grab the hostname, username and password? Maybe it's stored in your
> session or something, and that session is not working in your command line
> environment..? It could be just about anything that's your problem! :)
>
> My advice is to take a look att the parameters using to connect to the
> server, maybe echo them to stdout before doing your connect... It might be
> that they are not defined when running your script on command-line.
>
> In general, very few script are written in such a way that they work the
> same way in a webserver environment and on command line. You should design
> your scripts for either the environment.
>
> Greetings,
> Krister Karlström, Helsinki, Finland
>
> Molteni Davide wrote:
>
>  Hi,
> >
> > I have a problem with all my php scripts that use MS SQL Server, but
> > only
> > when I start them from the command line
> > I'm using Apache 2.2.4 with PHP 5.2.5 on a server Win2k3 with SP2, and
> > MS
> > SQL Server 2000 on another Win2k3 server.
> > If I run the same script using a webbrower as an internet page it works
> > fine,
> > but if I run it from the command line (c:\>php scipt.php) I will receive
> > messages like this:
> > "Warning: mssql_connect(): Unable to connect to server: servername,1433
> > in
> > c:\script.php on line #"
> > Can someone have an idea what could be the problem?
> > Can someone please help me?
> > What should I do to make it working?
> > Tanks a lot in advance.
> >
> > Davide
> >
> >


-- 
Davide Molteni
alla Stazione
6702 Claro
Tel. 091 630 1710
Nat. 076 381 3281


Re: [PHP-DB] mssql_connect error only on command line

2008-04-02 Thread Krister Karlström

Hi!

That description did not help us very much... I think you're just 
connecting using the wrong credentials, or using no at all. From where 
do you grab the hostname, username and password? Maybe it's stored in 
your session or something, and that session is not working in your 
command line environment..? It could be just about anything that's your 
problem! :)


My advice is to take a look att the parameters using to connect to the 
server, maybe echo them to stdout before doing your connect... It might 
be that they are not defined when running your script on command-line.


In general, very few script are written in such a way that they work the 
same way in a webserver environment and on command line. You should 
design your scripts for either the environment.


Greetings,
Krister Karlström, Helsinki, Finland

Molteni Davide wrote:


 Hi,

I have a problem with all my php scripts that use MS SQL Server, but only
when I start them from the command line
I'm using Apache 2.2.4 with PHP 5.2.5 on a server Win2k3 with SP2, and MS
SQL Server 2000 on another Win2k3 server.
If I run the same script using a webbrower as an internet page it works
fine,
but if I run it from the command line (c:\>php scipt.php) I will receive
messages like this:
"Warning: mssql_connect(): Unable to connect to server: servername,1433 in
c:\script.php on line #"
Can someone have an idea what could be the problem?
Can someone please help me?
What should I do to make it working?
Tanks a lot in advance.

Davide



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] mssql_connect error only on command line

2008-04-02 Thread Molteni Davide
 Hi,

I have a problem with all my php scripts that use MS SQL Server, but only
when I start them from the command line
I'm using Apache 2.2.4 with PHP 5.2.5 on a server Win2k3 with SP2, and MS
SQL Server 2000 on another Win2k3 server.
If I run the same script using a webbrower as an internet page it works
fine,
but if I run it from the command line (c:\>php scipt.php) I will receive
messages like this:
"Warning: mssql_connect(): Unable to connect to server: servername,1433 in
c:\script.php on line #"
Can someone have an idea what could be the problem?
Can someone please help me?
What should I do to make it working?
Tanks a lot in advance.

Davide