php-windows Digest 13 Apr 2002 10:20:30 -0000 Issue 1091

Topics (messages 13062 through 13074):

Different folder | Local test - Help!! (part2)
        13062 by: Tiago Simões
        13063 by: Nicole Amashta
        13074 by: firepages

Re: Another Newbie Question
        13064 by: Nicole Amashta
        13065 by: Nicole Amashta

Re: String reduce
        13066 by: Ross Fleming
        13069 by: Nicole Amashta
        13070 by: Nicole Amashta
        13071 by: Nicole Amashta

Re: PHP and ZIP
        13067 by: Ross Fleming
        13068 by: Nicole Amashta

Re: Tutorials on stored procedures using SQL Server
        13072 by: Fabian Deutsch
        13073 by: Marck D Pearlstone

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
For those that haven't read my previous posts, i'm trying to be able to test
locally my site php site. My installation (both apache and php) went
smoothly. But instead of using the htdocs folder for the test i wanted to
use the c:\website folder. So with some help from you guys i manage to
configure the httpd.conf file (in the conf Apache subfolder) like this:

#this is the bottom part of the conf file

<VirtualHost website.localhost>
    DocumentRoot "C:\merda"
    ServerName website.localhost
</VirtualHost>

<Directory "C:/website">
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php4
#Next line is optional (for viewing source)
AddType application/x-httpd-php-source .phps
</Directory>


and in the hosts.sam file in the C:\Windows\

127.0.0.1       localhost
127.0.0.1       website.localhost

It "sounds good to me. So why it doesn't work? Any ideas?





--- End Message ---
--- Begin Message ---
Make sure you have also set correctly the path to your webserver in your
php.ini.

--
Nicole Amashta
Web Application Development
ABOL Software, Inc.
( 678 ) 494 - 3172 ext. 201
[EMAIL PROTECTED]
"Tiago SimõEs" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> For those that haven't read my previous posts, i'm trying to be able to
test
> locally my site php site. My installation (both apache and php) went
> smoothly. But instead of using the htdocs folder for the test i wanted to
> use the c:\website folder. So with some help from you guys i manage to
> configure the httpd.conf file (in the conf Apache subfolder) like this:
>
> #this is the bottom part of the conf file
>
> <VirtualHost website.localhost>
>     DocumentRoot "C:\merda"
>     ServerName website.localhost
> </VirtualHost>
>
> <Directory "C:/website">
> AddType application/x-httpd-php .php
> AddType application/x-httpd-php .php4
> #Next line is optional (for viewing source)
> AddType application/x-httpd-php-source .phps
> </Directory>
>
>
> and in the hosts.sam file in the C:\Windows\
>
> 127.0.0.1       localhost
> 127.0.0.1       website.localhost
>
> It "sounds good to me. So why it doesn't work? Any ideas?
>
>
>
>
>


--- End Message ---
--- Begin Message ---
Why not just set your DocumentRoot to "C:/"

or set up an alias - its much more likely to work than a virtual host

      Alias /C/ "c:/"
    <Directory "c:/">
       DirectoryIndex index.php index.htm index.html
    </Directory>

you would then access as

http://localhost/C/


"Tiago SimõEs" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> For those that haven't read my previous posts, i'm trying to be able to
test
> locally my site php site. My installation (both apache and php) went
> smoothly. But instead of using the htdocs folder for the test i wanted to
> use the c:\website folder. So with some help from you guys i manage to
> configure the httpd.conf file (in the conf Apache subfolder) like this:
>
> #this is the bottom part of the conf file
>
> <VirtualHost website.localhost>
>     DocumentRoot "C:\merda"
>     ServerName website.localhost
> </VirtualHost>
>
> <Directory "C:/website">
> AddType application/x-httpd-php .php
> AddType application/x-httpd-php .php4
> #Next line is optional (for viewing source)
> AddType application/x-httpd-php-source .phps
> </Directory>
>
>
> and in the hosts.sam file in the C:\Windows\
>
> 127.0.0.1       localhost
> 127.0.0.1       website.localhost
>
> It "sounds good to me. So why it doesn't work? Any ideas?
>
>
>
>
>


--- End Message ---
--- Begin Message ---
######## Your code:
<snip>
<?php
mysql_connect("nik", "", "") or
  die("could not connect to the database");
mysql_select_db("guestbook") or
die ("could not connect to the specified database");
?>
</snip>

######## My code:
## Assuming "nik" is your host
## and no username and password are required ...
<snip>
$link = mysql_connect("nik", "", "") or  die("could not connect to the
database. Reason: " . mysql_error_message()  );

 mysql_select_db("guestbook", $link) or die ("could not connect to the
specified database. Reason: " mysql_error_message());
</snip>

Notice that you need to get the return from mysql_connect and pass it as 2nd
param to mysql_select_db.

Hope that works.


--
Nicole Amashta
Web Application Development
ABOL Software, Inc.
"Nik Alleyne" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Good evening everyone,
> I am new (very new) to php. I was doing some research on the net and learn
> of this packaged and after reading just a couple of pages, i figure i
should
> learn this instead of ASP. It looks so easy. Anyhow here is my problem.
>
> I am trying to connect to the database (MySQL) however, I can't I am
> connecting to the server, but I cannot connect to my sample database.
>
> Here is my script?
> <?php
> mysql_connect("nik", "", "") or
>   die("could not connect to the database");
> mysql_select_db("guestbook") or
> die ("could not connect to the specified database");
> ?>
> I'm getting the "could not connect to the specified database" message.
> P.S. The database exists.
>
> Please Help
> Thx
> Nik
>
>
>
>




--- End Message ---
--- Begin Message ---
######## Your code:
<snip>
<?php
mysql_connect("nik", "", "") or
  die("could not connect to the database");
mysql_select_db("guestbook") or
die ("could not connect to the specified database");
?>
</snip>

######## My code:
## Assuming "nik" is your host
## and no username and password are required ...
<snip>
$link = mysql_connect("nik", "", "") or  die("Could not connect to host.
Reason: " . mysql_error_message()  );

 mysql_select_db("guestbook", $link) or die ("Could not connect to the
specified database. Reason: " mysql_error_message());
</snip>

Notice that you need to get the return from mysql_connect and pass it as 2nd
param to mysql_select_db.

Hope that works.


--
Nicole Amashta
Web Application Development
ABOL Software, Inc.
"Nik Alleyne" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Good evening everyone,
> I am new (very new) to php. I was doing some research on the net and learn
> of this packaged and after reading just a couple of pages, i figure i
should
> learn this instead of ASP. It looks so easy. Anyhow here is my problem.
>
> I am trying to connect to the database (MySQL) however, I can't I am
> connecting to the server, but I cannot connect to my sample database.
>
> Here is my script?
> <?php
> mysql_connect("nik", "", "") or
>   die("could not connect to the database");
> mysql_select_db("guestbook") or
> die ("could not connect to the specified database");
> ?>
> I'm getting the "could not connect to the specified database" message.
> P.S. The database exists.
>
> Please Help
> Thx
> Nik
>
>
>
>






--- End Message ---
--- Begin Message ---
Sorry, but neither of these suggestions work on my server, and it would
probably run into problems if one of the "Mot"s had a _ at the beginning or
end.  Nicola's first offering gives:
Mot1_;Mot2_;_;_;_;_;_;_;_Mot3_;_;_;Mot4_;_;_;_;_Mot5_;_;Mot6

The second one gives:
Mot1;Mot2;;;;;;;_Mot3;;;Mot4;;;;_Mot5;;Mot6

My solution?  Recursively replace ";;" with ";" until the string doesn't get
any shorter.  This one works and is pretty neat:


<?
$str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";

$length=-1;

while ($length != strlen($str)) {
  $length = strlen($str);
  $str = str_replace(";;", ";", $str);
}

echo $str;
?>

Returns:
Mot1;Mot2;Mot3;Mot4;Mot5;Mot6
as required

Regards

Ross

-----Original Message-----
From: Nicola Delbono [mailto:[EMAIL PROTECTED]]
Sent: 12 April 2002 18:31
To: Matt Babineau
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] String reduce



I added the underscore artificially in order to make the string become

Mot1_;__;_Mot2_;__;__;__;__;__;__;__;__;__;_Mot3_;__;__;_andsoon;;;M
ot4;;;;;;;Mot5;;;;Mot6

so ONLY the first(s) ";" begin with just ONE underscore
the other  begins with 2 underscores, so you can recognize them
and strip them away.



the correct version would be

$str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";
$str = str_replace(";", "_;_", $str);
$str = str_replace("__;_", "", $str);
$str = str_replace("_;", ";", $str);


The string is:
        Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6

then becomes
$str = str_replace(";", "_;_", $str);

Mot1_;__;_Mot2_;__;__;__;__;__;__;__;__;__;_Mot3_;__;__;_andsoon;;;M
ot4;;;;;;;Mot5;;;;Mot6

then becomes
$str = str_replace("__;_", "", $str);
        Mot1_;Mot2_;Mot3_;Mot4_;Mot5_;Mot6

then becomes
$str = str_replace("_;", ";", $str);
        Mot1;Mot2;Mot3;Mot4;Mot5;Mot6


It's horrible but it works... ( yet I didn't test it )


Bye




*********** REPLY SEPARATOR  ***********

On 12/04/2002 at 12.50 Matt Babineau wrote:

>What does the underscore do in this situation?
>
>-----Original Message-----
>From: Nicola Delbono [mailto:[EMAIL PROTECTED]]
>Sent: Friday, April 12, 2002 12:43 PM
>To: Kriegers Horst; 'PHP-Windows'
>Subject: Re: [PHP-WIN] String reduce
>
>
>
>try
>$str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";
>$str = str_replace(";", "_;_", $str);
>$str = str_replace("__;_", "", $str);
>
>:-D
>
>
>
>
>
>
>*********** REPLY SEPARATOR  ***********
>
>On 12/04/2002 at 16.10 Kriegers Horst wrote:
>
>>Hi all,
>>
>>how can I replace the n ; with only one
>>
>>Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6
>>==>
>>Mot1;Mot2;Mot3;Mot4;Mot5;Mot6
>>
>>So that I can explode it in an array.
>>
>>Thanks for your help
>>Horst
>>
>>
>>
>>--
>>PHP Windows Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>dr. Nicola Delbono
>[EMAIL PROTECTED]
>Key5 di Delbono Nicola
>V. G.M. Rossi, 12
>25038 Rovato (Bs)
>Tel 39 030 7242266
>Fax 39 030 7242266
>
>www.smscitta.com | www.musicalbox.it
>www.filosofo.it | www.bollicine.com
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php




dr. Nicola Delbono
[EMAIL PROTECTED]
Key5 di Delbono Nicola
V. G.M. Rossi, 12
25038 Rovato (Bs)
Tel 39 030 7242266
Fax 39 030 7242266

www.smscitta.com | www.musicalbox.it
www.filosofo.it | www.bollicine.com


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

--- End Message ---
--- Begin Message ---
you could do it like so, also:

<?
$str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";

while ( strstr(";;", $str) )  ## if exists ;; in $str, replace with 1 ;
 $str = str_replace( ";", $str );
?>

works for ya, I hope.

peaces,

-----
Nicole Amashta
Web Application Developer
www.aeontrek.com


"Ross Fleming" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Sorry, but neither of these suggestions work on my server, and it would
> probably run into problems if one of the "Mot"s had a _ at the beginning
or
> end.  Nicola's first offering gives:
> Mot1_;Mot2_;_;_;_;_;_;_;_Mot3_;_;_;Mot4_;_;_;_;_Mot5_;_;Mot6
>
> The second one gives:
> Mot1;Mot2;;;;;;;_Mot3;;;Mot4;;;;_Mot5;;Mot6
>
> My solution?  Recursively replace ";;" with ";" until the string doesn't
get
> any shorter.  This one works and is pretty neat:
>
>
> <?
> $str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";
>
> $length=-1;
>
> while ($length != strlen($str)) {
>   $length = strlen($str);
>   $str = str_replace(";;", ";", $str);
> }
>
> echo $str;
> ?>
>
> Returns:
> Mot1;Mot2;Mot3;Mot4;Mot5;Mot6
> as required
>
> Regards
>
> Ross
>
> -----Original Message-----
> From: Nicola Delbono [mailto:[EMAIL PROTECTED]]
> Sent: 12 April 2002 18:31
> To: Matt Babineau
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] String reduce
>
>
>
> I added the underscore artificially in order to make the string become
>
> Mot1_;__;_Mot2_;__;__;__;__;__;__;__;__;__;_Mot3_;__;__;_andsoon;;;M
> ot4;;;;;;;Mot5;;;;Mot6
>
> so ONLY the first(s) ";" begin with just ONE underscore
> the other  begins with 2 underscores, so you can recognize them
> and strip them away.
>
>
>
> the correct version would be
>
> $str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";
> $str = str_replace(";", "_;_", $str);
> $str = str_replace("__;_", "", $str);
> $str = str_replace("_;", ";", $str);
>
>
> The string is:
> Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6
>
> then becomes
> $str = str_replace(";", "_;_", $str);
>
> Mot1_;__;_Mot2_;__;__;__;__;__;__;__;__;__;_Mot3_;__;__;_andsoon;;;M
> ot4;;;;;;;Mot5;;;;Mot6
>
> then becomes
> $str = str_replace("__;_", "", $str);
> Mot1_;Mot2_;Mot3_;Mot4_;Mot5_;Mot6
>
> then becomes
> $str = str_replace("_;", ";", $str);
> Mot1;Mot2;Mot3;Mot4;Mot5;Mot6
>
>
> It's horrible but it works... ( yet I didn't test it )
>
>
> Bye
>
>
>
>
> *********** REPLY SEPARATOR  ***********
>
> On 12/04/2002 at 12.50 Matt Babineau wrote:
>
> >What does the underscore do in this situation?
> >
> >-----Original Message-----
> >From: Nicola Delbono [mailto:[EMAIL PROTECTED]]
> >Sent: Friday, April 12, 2002 12:43 PM
> >To: Kriegers Horst; 'PHP-Windows'
> >Subject: Re: [PHP-WIN] String reduce
> >
> >
> >
> >try
> >$str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";
> >$str = str_replace(";", "_;_", $str);
> >$str = str_replace("__;_", "", $str);
> >
> >:-D
> >
> >
> >
> >
> >
> >
> >*********** REPLY SEPARATOR  ***********
> >
> >On 12/04/2002 at 16.10 Kriegers Horst wrote:
> >
> >>Hi all,
> >>
> >>how can I replace the n ; with only one
> >>
> >>Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6
> >>==>
> >>Mot1;Mot2;Mot3;Mot4;Mot5;Mot6
> >>
> >>So that I can explode it in an array.
> >>
> >>Thanks for your help
> >>Horst
> >>
> >>
> >>
> >>--
> >>PHP Windows Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> >
> >dr. Nicola Delbono
> >[EMAIL PROTECTED]
> >Key5 di Delbono Nicola
> >V. G.M. Rossi, 12
> >25038 Rovato (Bs)
> >Tel 39 030 7242266
> >Fax 39 030 7242266
> >
> >www.smscitta.com | www.musicalbox.it
> >www.filosofo.it | www.bollicine.com
> >
> >
> >--
> >PHP Windows Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> dr. Nicola Delbono
> [EMAIL PROTECTED]
> Key5 di Delbono Nicola
> V. G.M. Rossi, 12
> 25038 Rovato (Bs)
> Tel 39 030 7242266
> Fax 39 030 7242266
>
> www.smscitta.com | www.musicalbox.it
> www.filosofo.it | www.bollicine.com
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
well, my code was wrong:

>  $str = str_replace( ";", $str );

should have been:
 $str = str_replace( ";;", ";",  $str );


but doesn't seem to work anyway.

--
-----
Nicole Amashta
Web Application Developer
www.aeontrek.com
"Nicole Amashta" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> you could do it like so, also:
>
> <?
> $str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";
>
> while ( strstr(";;", $str) )  ## if exists ;; in $str, replace with 1 ;
>  $str = str_replace( ";", $str );
> ?>
>
> works for ya, I hope.
>
> peaces,
>
> -----
> Nicole Amashta
> Web Application Developer
> www.aeontrek.com
>
>
> "Ross Fleming" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Sorry, but neither of these suggestions work on my server, and it would
> > probably run into problems if one of the "Mot"s had a _ at the beginning
> or
> > end.  Nicola's first offering gives:
> > Mot1_;Mot2_;_;_;_;_;_;_;_Mot3_;_;_;Mot4_;_;_;_;_Mot5_;_;Mot6
> >
> > The second one gives:
> > Mot1;Mot2;;;;;;;_Mot3;;;Mot4;;;;_Mot5;;Mot6
> >
> > My solution?  Recursively replace ";;" with ";" until the string doesn't
> get
> > any shorter.  This one works and is pretty neat:
> >
> >
> > <?
> > $str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";
> >
> > $length=-1;
> >
> > while ($length != strlen($str)) {
> >   $length = strlen($str);
> >   $str = str_replace(";;", ";", $str);
> > }
> >
> > echo $str;
> > ?>
> >
> > Returns:
> > Mot1;Mot2;Mot3;Mot4;Mot5;Mot6
> > as required
> >
> > Regards
> >
> > Ross
> >
> > -----Original Message-----
> > From: Nicola Delbono [mailto:[EMAIL PROTECTED]]
> > Sent: 12 April 2002 18:31
> > To: Matt Babineau
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] String reduce
> >
> >
> >
> > I added the underscore artificially in order to make the string become
> >
> > Mot1_;__;_Mot2_;__;__;__;__;__;__;__;__;__;_Mot3_;__;__;_andsoon;;;M
> > ot4;;;;;;;Mot5;;;;Mot6
> >
> > so ONLY the first(s) ";" begin with just ONE underscore
> > the other  begins with 2 underscores, so you can recognize them
> > and strip them away.
> >
> >
> >
> > the correct version would be
> >
> > $str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";
> > $str = str_replace(";", "_;_", $str);
> > $str = str_replace("__;_", "", $str);
> > $str = str_replace("_;", ";", $str);
> >
> >
> > The string is:
> > Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6
> >
> > then becomes
> > $str = str_replace(";", "_;_", $str);
> >
> > Mot1_;__;_Mot2_;__;__;__;__;__;__;__;__;__;_Mot3_;__;__;_andsoon;;;M
> > ot4;;;;;;;Mot5;;;;Mot6
> >
> > then becomes
> > $str = str_replace("__;_", "", $str);
> > Mot1_;Mot2_;Mot3_;Mot4_;Mot5_;Mot6
> >
> > then becomes
> > $str = str_replace("_;", ";", $str);
> > Mot1;Mot2;Mot3;Mot4;Mot5;Mot6
> >
> >
> > It's horrible but it works... ( yet I didn't test it )
> >
> >
> > Bye
> >
> >
> >
> >
> > *********** REPLY SEPARATOR  ***********
> >
> > On 12/04/2002 at 12.50 Matt Babineau wrote:
> >
> > >What does the underscore do in this situation?
> > >
> > >-----Original Message-----
> > >From: Nicola Delbono [mailto:[EMAIL PROTECTED]]
> > >Sent: Friday, April 12, 2002 12:43 PM
> > >To: Kriegers Horst; 'PHP-Windows'
> > >Subject: Re: [PHP-WIN] String reduce
> > >
> > >
> > >
> > >try
> > >$str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";
> > >$str = str_replace(";", "_;_", $str);
> > >$str = str_replace("__;_", "", $str);
> > >
> > >:-D
> > >
> > >
> > >
> > >
> > >
> > >
> > >*********** REPLY SEPARATOR  ***********
> > >
> > >On 12/04/2002 at 16.10 Kriegers Horst wrote:
> > >
> > >>Hi all,
> > >>
> > >>how can I replace the n ; with only one
> > >>
> > >>Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6
> > >>==>
> > >>Mot1;Mot2;Mot3;Mot4;Mot5;Mot6
> > >>
> > >>So that I can explode it in an array.
> > >>
> > >>Thanks for your help
> > >>Horst
> > >>
> > >>
> > >>
> > >>--
> > >>PHP Windows Mailing List (http://www.php.net/)
> > >>To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> > >
> > >dr. Nicola Delbono
> > >[EMAIL PROTECTED]
> > >Key5 di Delbono Nicola
> > >V. G.M. Rossi, 12
> > >25038 Rovato (Bs)
> > >Tel 39 030 7242266
> > >Fax 39 030 7242266
> > >
> > >www.smscitta.com | www.musicalbox.it
> > >www.filosofo.it | www.bollicine.com
> > >
> > >
> > >--
> > >PHP Windows Mailing List (http://www.php.net/)
> > >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> >
> > dr. Nicola Delbono
> > [EMAIL PROTECTED]
> > Key5 di Delbono Nicola
> > V. G.M. Rossi, 12
> > 25038 Rovato (Bs)
> > Tel 39 030 7242266
> > Fax 39 030 7242266
> >
> > www.smscitta.com | www.musicalbox.it
> > www.filosofo.it | www.bollicine.com
> >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>


--- End Message ---
--- Begin Message ---
Here it is, but I used preg instead:

<?
$str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";

echo "Before: " . $str . "<p>";

/*
while ( strstr(";;", $str) )  ## if exists ;; in $str, replace with 1 ;
{
 $str = str_replace( ";;", ";", $str );
}
*/

while( preg_match( "/;;/", $str ) )
{
 $str = preg_replace( "/;;/", ";", $str );
}

echo "After: " . $str;
?>


And it works!
;)

--
-----
Nicole Amashta
Web Application Developer
www.aeontrek.com
"Nicole Amashta" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> you could do it like so, also:
>
> <?
> $str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";
>
> while ( strstr(";;", $str) )  ## if exists ;; in $str, replace with 1 ;
>  $str = str_replace( ";", $str );
> ?>
>
> works for ya, I hope.
>
> peaces,
>
> -----
> Nicole Amashta
> Web Application Developer
> www.aeontrek.com
>
>
> "Ross Fleming" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Sorry, but neither of these suggestions work on my server, and it would
> > probably run into problems if one of the "Mot"s had a _ at the beginning
> or
> > end.  Nicola's first offering gives:
> > Mot1_;Mot2_;_;_;_;_;_;_;_Mot3_;_;_;Mot4_;_;_;_;_Mot5_;_;Mot6
> >
> > The second one gives:
> > Mot1;Mot2;;;;;;;_Mot3;;;Mot4;;;;_Mot5;;Mot6
> >
> > My solution?  Recursively replace ";;" with ";" until the string doesn't
> get
> > any shorter.  This one works and is pretty neat:
> >
> >
> > <?
> > $str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";
> >
> > $length=-1;
> >
> > while ($length != strlen($str)) {
> >   $length = strlen($str);
> >   $str = str_replace(";;", ";", $str);
> > }
> >
> > echo $str;
> > ?>
> >
> > Returns:
> > Mot1;Mot2;Mot3;Mot4;Mot5;Mot6
> > as required
> >
> > Regards
> >
> > Ross
> >
> > -----Original Message-----
> > From: Nicola Delbono [mailto:[EMAIL PROTECTED]]
> > Sent: 12 April 2002 18:31
> > To: Matt Babineau
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] String reduce
> >
> >
> >
> > I added the underscore artificially in order to make the string become
> >
> > Mot1_;__;_Mot2_;__;__;__;__;__;__;__;__;__;_Mot3_;__;__;_andsoon;;;M
> > ot4;;;;;;;Mot5;;;;Mot6
> >
> > so ONLY the first(s) ";" begin with just ONE underscore
> > the other  begins with 2 underscores, so you can recognize them
> > and strip them away.
> >
> >
> >
> > the correct version would be
> >
> > $str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";
> > $str = str_replace(";", "_;_", $str);
> > $str = str_replace("__;_", "", $str);
> > $str = str_replace("_;", ";", $str);
> >
> >
> > The string is:
> > Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6
> >
> > then becomes
> > $str = str_replace(";", "_;_", $str);
> >
> > Mot1_;__;_Mot2_;__;__;__;__;__;__;__;__;__;_Mot3_;__;__;_andsoon;;;M
> > ot4;;;;;;;Mot5;;;;Mot6
> >
> > then becomes
> > $str = str_replace("__;_", "", $str);
> > Mot1_;Mot2_;Mot3_;Mot4_;Mot5_;Mot6
> >
> > then becomes
> > $str = str_replace("_;", ";", $str);
> > Mot1;Mot2;Mot3;Mot4;Mot5;Mot6
> >
> >
> > It's horrible but it works... ( yet I didn't test it )
> >
> >
> > Bye
> >
> >
> >
> >
> > *********** REPLY SEPARATOR  ***********
> >
> > On 12/04/2002 at 12.50 Matt Babineau wrote:
> >
> > >What does the underscore do in this situation?
> > >
> > >-----Original Message-----
> > >From: Nicola Delbono [mailto:[EMAIL PROTECTED]]
> > >Sent: Friday, April 12, 2002 12:43 PM
> > >To: Kriegers Horst; 'PHP-Windows'
> > >Subject: Re: [PHP-WIN] String reduce
> > >
> > >
> > >
> > >try
> > >$str = "Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6";
> > >$str = str_replace(";", "_;_", $str);
> > >$str = str_replace("__;_", "", $str);
> > >
> > >:-D
> > >
> > >
> > >
> > >
> > >
> > >
> > >*********** REPLY SEPARATOR  ***********
> > >
> > >On 12/04/2002 at 16.10 Kriegers Horst wrote:
> > >
> > >>Hi all,
> > >>
> > >>how can I replace the n ; with only one
> > >>
> > >>Mot1;;Mot2;;;;;;;;;;;;;Mot3;;;;;;Mot4;;;;;;;Mot5;;;;Mot6
> > >>==>
> > >>Mot1;Mot2;Mot3;Mot4;Mot5;Mot6
> > >>
> > >>So that I can explode it in an array.
> > >>
> > >>Thanks for your help
> > >>Horst
> > >>
> > >>
> > >>
> > >>--
> > >>PHP Windows Mailing List (http://www.php.net/)
> > >>To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> > >
> > >dr. Nicola Delbono
> > >[EMAIL PROTECTED]
> > >Key5 di Delbono Nicola
> > >V. G.M. Rossi, 12
> > >25038 Rovato (Bs)
> > >Tel 39 030 7242266
> > >Fax 39 030 7242266
> > >
> > >www.smscitta.com | www.musicalbox.it
> > >www.filosofo.it | www.bollicine.com
> > >
> > >
> > >--
> > >PHP Windows Mailing List (http://www.php.net/)
> > >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> >
> > dr. Nicola Delbono
> > [EMAIL PROTECTED]
> > Key5 di Delbono Nicola
> > V. G.M. Rossi, 12
> > 25038 Rovato (Bs)
> > Tel 39 030 7242266
> > Fax 39 030 7242266
> >
> > www.smscitta.com | www.musicalbox.it
> > www.filosofo.it | www.bollicine.com
> >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>


--- End Message ---
--- Begin Message ---
Easiest solution I can think of would be to find a copy of the dos
executable, pkzip and use the exec(); command to run that.  Otherwise I'm
stumped

Ross

-----Original Message-----
From: Nicole Amashta [mailto:[EMAIL PROTECTED]]
Sent: 12 April 2002 17:33
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] PHP and ZIP


I thought I had seen some functions for creating zip files with PHP. I can't
find what I'm looking for to specifically create .zip files that are
decompressable by, say, winZip.

Anyone have experience creating .zip files with PHP? If so, could you point
me to the name of the function for doing this?

I found ZLib, but this doesn't seem to do what I want.

Much appreciated and TIA!

--
Nicole Amashta
Web Application Development
ABOL Software, Inc.
[EMAIL PROTECTED]





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

--- End Message ---
--- Begin Message ---
Yeah, that was my first plan. i thought i might be able to do it with
winzip, though - if has a command line. But thanks anyway.

--
-----
Nicole Amashta
Web Application Developer
www.aeontrek.com
"Ross Fleming" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Easiest solution I can think of would be to find a copy of the dos
> executable, pkzip and use the exec(); command to run that.  Otherwise I'm
> stumped
>
> Ross
>
> -----Original Message-----
> From: Nicole Amashta [mailto:[EMAIL PROTECTED]]
> Sent: 12 April 2002 17:33
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] PHP and ZIP
>
>
> I thought I had seen some functions for creating zip files with PHP. I
can't
> find what I'm looking for to specifically create .zip files that are
> decompressable by, say, winZip.
>
> Anyone have experience creating .zip files with PHP? If so, could you
point
> me to the name of the function for doing this?
>
> I found ZLib, but this doesn't seem to do what I want.
>
> Much appreciated and TIA!
>
> --
> Nicole Amashta
> Web Application Development
> ABOL Software, Inc.
> [EMAIL PROTECTED]
>
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
What exactly do u mean? storing functions in an database?

fabian

"R.S. Herhuth" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Anyone know of any internet based tutorials on using stored procedures
> with SQL Server?
>
> Thanks,
> ROn


--- End Message ---
--- Begin Message ---
Hi Fabian,

@13 April 2002, 02:07:26 +0200 (01:07 UK time) Fabian Deutsch wrote
this to [EMAIL PROTECTED]

>> Anyone know of any internet based tutorials on using stored
>> procedures with SQL Server?

FD> What exactly do u mean? storing functions in an database?

SQL servers can store pre-programmed sequences of SQL instructions in
a "subroutine" type format for simplified execution of standardised
functions. These are known as Stored Procedures.

-- 
Cheers -- .\\arck D. Pearlstone -- Consultant Software Engineer
___________________________________________________________________
\ BrainStorm - Brain extension - see http://www.brainstormsw.com  /
 \ PGP Key ID: 0x929DCDA0     | www: http://www.silverstones.com /


--- End Message ---

Reply via email to