php-general Digest 24 Dec 2001 07:34:02 -0000 Issue 1070

Topics (messages 78617 through 78641):

Re: Prev ... Next
        78617 by: Andrey Hristov

Re: How to parse an XML document
        78618 by: Manuel Lemos

Re: PHP software tool
        78619 by: Dasmeet Singh Arora

If/else conditional statement ...
        78620 by: Robert Dyke
        78622 by: Bogdan Stancescu
        78623 by: Miles Thompson
        78624 by: Bogdan Stancescu
        78627 by: Michael Sims
        78640 by: Casey Allen Shobe

Why Can't I Get PHP to Work with MySQL??
        78621 by: Ben Ocean
        78625 by: Michael Sims
        78629 by: Ben Ocean
        78635 by: Brian Clark

Table Problem
        78626 by: Phillip B. Bruce

Re: If/else conditional statement ... in an include file ...
        78628 by: Robert Dyke

4.0.6  Vs.  4.1.0 ?
        78630 by: Robert Dyke

Merry christmas!
        78631 by: Emile Bosch

$GLOBALS array
        78632 by: Philip MacIver
        78634 by: Gaylen Fraley

Re: How to compile Apache/PHP
        78633 by: Brian Clark

is_dir and cache problem ...
        78636 by: Daniel Urstöger
        78637 by: Bogdan Stancescu
        78638 by: Bogdan Stancescu
        78639 by: Daniel Urstöger

Re: how to show different types of images?
        78641 by: Boulgakov Andrei

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 ---
The sql is
select name from  members limit offset,10;

you have to generate offet which _must_ be an integer.

Regards,
Andrey  Hristov


----- Original Message ----- 
From: "Rambo Amadeus" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 23, 2001 6:06 PM
Subject: [PHP] Prev ... Next


> Hi,
> I have about 100 names in mysql. How can i display them in groups of 10, and
> have next and previous links.
> 
> Thanks
> 
> 
> -- 
> 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]
> 
> 

--- End Message ---
--- Begin Message ---
Hello,

Php Rules wrote:
> 
> Hi fellas.
> 
> I would like to know the way to parse an XML document.
> 
> I come from Java world, and you can handle an XML document,
> and
> then show it as an HTML page.
> 
> I suppose that it's also possible by using PHP, isn't it?
> 
> I would like also to know if it's available in the 'standard
> installation' of PHP. I mean, I want to develop this on a
> remote
> server. It uses PHP, and I suppose that it's not installated
> any
> extra module, so I wonder if the XML parsing needs any extra
> module
> or not.

PHP comes built in support for parsing XML documents with James Clark
Expat parser and also GNOME DOM XML parser.

I used Expat support for bulding this generic parser class that puts all
tags and data in a single associative array indexed by they path name
encoded in a single string.

http://phpclasses.upperdesign.com/browse.html/package/4

In the same site you may also find many other classes for processing and
generating XML:

http://phpclasses.upperdesign.com/browse.html/class/4

If you came from the Java world, you will appreciate the whole site
because it is a repository from OOP classes of objects written in PHP:

http://phpclasses.upperdesign.com/browse.html

And also this mailing list that is meant for discussing OOP in PHP. It
was started just a few days ago, but it already has almost 200
subscribers. Here you may find answers for you OOP with PHP questions.

http://groups.yahoo.com/group/php-objects/


Regards,
Manuel Lemos
--- End Message ---
--- Begin Message ---
Check ConTEXT at http://www.fixedsys.com/context
It not only supports PHP but many other.Got good Syntax Highlighting and
other features.


On Sun, 2001-12-23 at 00:16, LaserJetter wrote:
> Does anybody know of or can recommend any freeware text editing tools for
> editing PHP code in Win32?
> I can manage with Windows' Notepad but something with code highlighting etc
> and of a similar footprint to notepad would be useful.
> 
> 
> 
> -- 
> 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]
-- 





http://www.pluginjokes.com
Add FREE Dynamic Jokes To Your Site!
-- 





http://www.pluginjokes.com
Add FREE Dynamic Jokes To Your Site!
--- End Message ---
--- Begin Message ---
Hello:

In ASP I can write a Conditional statement like this:

<% If $varA == True Then %>
Straight HTML in here that only displays if $varA == True
<% Else %>
Straight HTML in here that only displays if $varA != True
<% End if %>

Translating this to PHP doesn't work:

<? If ($varA == True) {  ?>   // error is generated here ...


Is there some way to do it this way in PHP?  I'd rather not create a huge
variable and then echo that.

Thanks in advance.


Robert Dyke
Montana Software
http://www.montanasoft.com/
[EMAIL PROTECTED]

* For the best results please include the text of this message (cut and
paste if necessary) in your reply *





--- End Message ---
--- Begin Message ---
Make sure you close the accolade afterwords in PHP -- other than that, yes,
it works just fine!

For example this should work just fine:
---------
<?
  for ($i=0;$i<10;$i++) {
    if (!($i%3)) {
?>
  Found a multiple of three!
<?
    echo($i);
?><br><?
    }
  }
?>
----------

Bogdan

Robert Dyke wrote:

> Hello:
>
> In ASP I can write a Conditional statement like this:
>
> <% If $varA == True Then %>
> Straight HTML in here that only displays if $varA == True
> <% Else %>
> Straight HTML in here that only displays if $varA != True
> <% End if %>
>
> Translating this to PHP doesn't work:
>
> <? If ($varA == True) {  ?>   // error is generated here ...
>
> Is there some way to do it this way in PHP?  I'd rather not create a huge
> variable and then echo that.
>
> Thanks in advance.
>
> Robert Dyke
> Montana Software
> http://www.montanasoft.com/
> [EMAIL PROTECTED]
>
> * For the best results please include the text of this message (cut and
> paste if necessary) in your reply *
>
> --
> 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]

--- End Message ---
--- Begin Message ---
What's the error, just a parse error on line xx?
O tend to do a lot of echo 'ing, so this suggestion may not be much help.
How about adding a semicolon?
<? If ($varA == True) {  ; ?>

Miles

At 01:11 PM 12/23/2001 -0700, Robert Dyke wrote:
>Hello:
>
>In ASP I can write a Conditional statement like this:
>
><% If $varA == True Then %>
>Straight HTML in here that only displays if $varA == True
><% Else %>
>Straight HTML in here that only displays if $varA != True
><% End if %>
>
>Translating this to PHP doesn't work:
>
><? If ($varA == True) {  ?>   // error is generated here ...
>
>
>Is there some way to do it this way in PHP?  I'd rather not create a huge
>variable and then echo that.
>
>Thanks in advance.
>
>
>Robert Dyke
>Montana Software
>http://www.montanasoft.com/
>[EMAIL PROTECTED]
>
>* For the best results please include the text of this message (cut and
>paste if necessary) in your reply *
>
>
>
>
>
>
>--
>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]

--- End Message ---
--- Begin Message ---
Took a better look at your code -- you've capitalized "true" -- that may be
it.

Bogdan

--- End Message ---
--- Begin Message ---
At 01:11 PM 12/23/2001 -0700, Robert Dyke wrote:
>Hello:
>
>In ASP I can write a Conditional statement like this:
>
><% If $varA == True Then %>
>Straight HTML in here that only displays if $varA == True
><% Else %>
>Straight HTML in here that only displays if $varA != True
><% End if %>
>
>Translating this to PHP doesn't work:
>
><? If ($varA == True) {  ?>   // error is generated here ...
>
>
>Is there some way to do it this way in PHP?  I'd rather not create a huge
>variable and then echo that.

As others have pointed out, the above should work provided that you are 
terminating your curly braces properly.

Another (perhaps easier) option would be to use "alternate syntax" which is 
more similar to VBScript.  For example, the following works in PHP:

<?if($varA === true):?>
...html...
<?else:?>
...html...
<?endif?>

Note the colon's which are required.  The endif will need a semicolon if 
there are any other commands after it in the same code block.  Also, I 
don't believe you can mix alternate syntax and normal syntax in the same 
control structure.  For example, the following will probably give an error:

<?
if (condition):
         if (other condition) {
                 do stuff
         }
endif;
?>

You'd have to use alternate syntax on the nested if statement as well...

I personally prefer alternate syntax when I'm breaking into and out of PHP 
a lot, like the example above.  For more info:

http://www.php.net/manual/en/control-structures.alternative-syntax.php

--- End Message ---
--- Begin Message ---
On Sunday 23 December 2001 03:11 pm, Robert Dyke wrote:
> <% If $varA == True Then %>
> Straight HTML in here that only displays if $varA == True
> <% Else %>
> Straight HTML in here that only displays if $varA != True
> <% End if %>

<?php if $varA == true) { ?>
<b>$varA was true.</b>
<?php } else { ?>
<b>$varA was false.</b>
<?php } ?>

I heavily dislike this coding style, however, and personally would use 
something like this:

<?php
print ('<b>$varA was ');
if ($varA == true) {
        print ('true');
} else {
        print ('false');
}
print ('.</b>'."\n");
?>

-- 
Casey Allen Shobe
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Hi;
I get this error when I try to restart Apache:

Syntax error on line 236 of /etc/httpd/conf/httpd.conf:
Cannot load /etc/httpd/libexec/libphp4.so into server: 
/etc/httpd/libexec/libphp4.so

The above file does, of course, exist. I'm running RH71 i386 with MySQL and 
PHP installed from source files. Here's my config script:

./configure --with-apxs=/etc/httpd/bin/apxs --with-mysql=/usr/local/mysql 
--with-kerberos=/usr/kerberos --with-ldap=/usr/local/openldap

So, what gives? I've googled this one and it appears there's a lot of folks 
with this question unanswered!
TIA,
BenO


--- End Message ---
--- Begin Message ---
At 12:16 PM 12/23/2001 -0800, Ben Ocean wrote:
>Hi;
>I get this error when I try to restart Apache:
>
>Syntax error on line 236 of /etc/httpd/conf/httpd.conf:
>Cannot load /etc/httpd/libexec/libphp4.so into server: 
>/etc/httpd/libexec/libphp4.so
>
>The above file does, of course, exist. I'm running RH71 i386 with MySQL 
>and PHP installed from source files. Here's my config script:
>
>./configure --with-apxs=/etc/httpd/bin/apxs --with-mysql=/usr/local/mysql 
>--with-kerberos=/usr/kerberos --with-ldap=/usr/local/openldap
>
>So, what gives? I've googled this one and it appears there's a lot of 
>folks with this question unanswered!

 From the PHP INSTALL file:

<quote>
Note 3!  If you are on Linux and have installed shared libraries, make
sure the location of these shared libraries are listed in your
/etc/ld.so.conf file.  For example, if you have:

   /usr/local/lib/mysql/libmysqlclient.so

Make sure /etc/ld.so.conf contains:

   /usr/local/lib/mysql

Then run ldconfig.
</quote>

Do the above and this should take care of it.

--- End Message ---
--- Begin Message ---
At 02:32 PM 12/23/01 -0600, you wrote:
>At 12:16 PM 12/23/2001 -0800, Ben Ocean wrote:
>>Hi;
>>I get this error when I try to restart Apache:
>>
>>Syntax error on line 236 of /etc/httpd/conf/httpd.conf:
>>Cannot load /etc/httpd/libexec/libphp4.so into server: 
>>/etc/httpd/libexec/libphp4.so
>>
>>The above file does, of course, exist. I'm running RH71 i386 with MySQL 
>>and PHP installed from source files. Here's my config script:
>>
>>./configure --with-apxs=/etc/httpd/bin/apxs --with-mysql=/usr/local/mysql 
>>--with-kerberos=/usr/kerberos --with-ldap=/usr/local/openldap
>>
>>So, what gives? I've googled this one and it appears there's a lot of 
>>folks with this question unanswered!
>
> From the PHP INSTALL file:
>
><quote>
>Note 3!  If you are on Linux and have installed shared libraries, make
>sure the location of these shared libraries are listed in your
>/etc/ld.so.conf file.  For example, if you have:
>
>   /usr/local/lib/mysql/libmysqlclient.so
>
>Make sure /etc/ld.so.conf contains:
>
>   /usr/local/lib/mysql
>
>Then run ldconfig.
></quote>
>
>Do the above and this should take care of it.

Well, I'm afraid I've done all of that and the problem remains :(
I recalled I also had to hard-code something in the configure script that 
wasn't working properly:

# BENO'S CHANGE: LAST LINE BELOW COMMENT AS WELL...
#  for i in lib lib/mysql; do

#  str="$MYSQL_DIR/$i/libmysqlclient.*"
#  for j in `echo $str`; do
#    if test -r $j; then
#      MYSQL_LIB_DIR=$MYSQL_DIR/$i
#      break 2
#    fi
#  done
#
#  done
MYSQL_LIB_DIR=/usr/local/lib

(starts at around line 3350). I was getting this error:

configure: error: Cannot find mysqlclient library under /usr/local/mysql

whereas the library is actually found under /usr/local/lib/mysql. At any 
rate, made the edit and the error message disappeared, so I assume I did 
something right, but the fact that I had to make an edit makes me suspicious.
Any more ideas?
TIA,
BenO


--- End Message ---
--- Begin Message ---
* Ben Ocean ([EMAIL PROTECTED]) [Dec 23. 2001 16:45]:

> >>./configure --with-apxs=/etc/httpd/bin/apxs --with-mysql=/usr/local/mysql 
> >>--with-kerberos=/usr/kerberos --with-ldap=/usr/local/openldap

> >>So, what gives? I've googled this one and it appears there's a lot of 
> >>folks with this question unanswered!

[...]

> Well, I'm afraid I've done all of that and the problem remains :(
> I recalled I also had to hard-code something in the configure script that 
> wasn't working properly:

> # BENO'S CHANGE: LAST LINE BELOW COMMENT AS WELL...
> #  for i in lib lib/mysql; do

> #  str="$MYSQL_DIR/$i/libmysqlclient.*"
> #  for j in `echo $str`; do
> #    if test -r $j; then
> #      MYSQL_LIB_DIR=$MYSQL_DIR/$i
> #      break 2
> #    fi
> #  done
> #
> #  done
> MYSQL_LIB_DIR=/usr/local/lib

> (starts at around line 3350). I was getting this error:

> configure: error: Cannot find mysqlclient library under /usr/local/mysql

> whereas the library is actually found under /usr/local/lib/mysql. At any 

Didn't we just go over this yesterday? You needed to pass
--with-mysql=/usr/local instead of --with-mysql=/usr/local/mysql

In the configure you edited, it's going to be looking for [Whatever you
passed configure for --with-mysql] plus a) lib or b) lib/mysql plus
libmysqlclient.*

So when you pass configure --with-mysql=/usr/local/mysql and the path is
actually /usr/local/lib/mysql, you're making it look in a)
/usr/local/mysql/lib or b) /usr/local/mysql/lib/mysql

It doesn't find what it's looking for, so it tells you " Cannot find
mysqlclient library under /usr/local/mysql", which is the path you gave
it. The error is sort of misleading because it doesn't report *exactly*
where it looked, but it's correct nonetheless.

You need to pass it /usr/local because that is the correct *base* path. 
Now, after that, if it doesn't configure correctly, that's another story.

-- 
Brian Clark | Avoiding the general public since 1805!
Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8
Shin: A device for finding furniture in the dark.

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

   Look at the code below first:

<?php
     2
     3  include "include_fns.php";
     4  include "header_news.php";
     5
     6  $conn = db_connect();
     7
     8  $pages_sql = "select * from pages order by code";
     9  $pages_result = mysql_query($pages_sql, $conn);
    10
    11  while ($pages = mysql_fetch_array($pages_result)) {
    12
    13    $story_sql = "select * from stories
    14                  where page = '$pages[code]'
    15                  and published is not null
    16                  order by published desc";
    17    $story_result = mysql_query($story_sql, $conn);
    18    if (mysql_num_rows($story_result)) {
    19      $story = mysql_fetch_array($story_result);
    20      print "<TABLE border=\"1\" width=685>";
    21      print "<TR>";
    22      print "<TD width=\"50%\">";
    23      print "<H3>$pages[description]</H3>";
    24      print $story[headline];
    25      print "</TD>";
    26      print "<TD ALIGN=RIGHT>";
    27      print "&nbsp;";
    28      print "</TD>";
    29      print "</TR>";
    30      print "</TABLE>";
    31    }
    32  }
    33
    34  include "footer_news.php";
    35  ?>

    My problem is that I want to do the following:

   ==========================================

|
|
    =========================================
    |
|                                              |
   ==========================================
    |
|                                               |
    =========================================

    So I thought a neat trick would be to before line 22 the following:

    if ( $pages[code]="intro")
        print "<TD >";
   else
        print "<TD width=\"50%\">";

   The objective would be to have a whole row by like I describe above.
    The thing is I don't want to write the same routine just for that
one row
     and by that I mean put in another mysql call to the database.

  Suggestion?


--
************************************************************
*** Phillip B. Bruce                                     ***
*** http://pbbruce.home.mindspring.com                   ***
*** [EMAIL PROTECTED]                               ***
***                                                      ***
*** "Have you ever noticed? Anybody going slower than    ***
*** you is an idiot, and anyone going faster than you    ***
*** is a maniac." - George Carlin                        ***
************************************************************



--- End Message ---
--- Begin Message ---
I apologize for not including all of the information.  I did this as an
include file, which explains why it isn't working:

< !--- beginning of myinclude.php ---- >

<? If ($varA == True) {  ?>

< ! --- end of myinclude.php --- >



< ! ---- beginning of testfile.php --- >
<?
Include('myinclude.php');
?>
Html here that should display only if $varA  == True

< ?
}  // generic parser error generated here
Else {
?>

HTML that only displays if $varA != True

<?
}
?>
< ! ----- End of testfile.php ---- >


In ASP this works, in PHP it doesn't ... any ideas?


"Michael Sims" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> At 01:11 PM 12/23/2001 -0700, Robert Dyke wrote:
> >Hello:
> >
> >In ASP I can write a Conditional statement like this:
> >
> ><% If $varA == True Then %>
> >Straight HTML in here that only displays if $varA == True
> ><% Else %>
> >Straight HTML in here that only displays if $varA != True
> ><% End if %>
> >
> >Translating this to PHP doesn't work:
> >
> ><? If ($varA == True) {  ?>   // error is generated here ...
> >
> >
> >Is there some way to do it this way in PHP?  I'd rather not create a huge
> >variable and then echo that.
>
> As others have pointed out, the above should work provided that you are
> terminating your curly braces properly.
>
> Another (perhaps easier) option would be to use "alternate syntax" which
is
> more similar to VBScript.  For example, the following works in PHP:
>
> <?if($varA === true):?>
> ...html...
> <?else:?>
> ...html...
> <?endif?>
>
> Note the colon's which are required.  The endif will need a semicolon if
> there are any other commands after it in the same code block.  Also, I
> don't believe you can mix alternate syntax and normal syntax in the same
> control structure.  For example, the following will probably give an
error:
>
> <?
> if (condition):
>          if (other condition) {
>                  do stuff
>          }
> endif;
> ?>
>
> You'd have to use alternate syntax on the nested if statement as well...
>
> I personally prefer alternate syntax when I'm breaking into and out of PHP
> a lot, like the example above.  For more info:
>
> http://www.php.net/manual/en/control-structures.alternative-syntax.php
>


--- End Message ---
--- Begin Message ---
Hi ... I'm getting ready to do a custom install of PHP on a Pair Networks
server, and I'm wondering which version I should go with.  It seems like
version 4.1.0 has some major changes and new features, which can sometimes
create bugs in the world of software.

What are your thoughts?  Pros and Cons?

Thanks in advance.


Robert Dyke
Montana Software
http://www.montanasoft.com/
[EMAIL PROTECTED]

* For the best results please include the text of this message (cut and
paste if necessary) in your reply *





--- End Message ---
--- Begin Message ---
Yeah i know it's offtopic =)

Anyway, i wish you all the best!

Cu in the next year!
Warm regards,
Emile


--- End Message ---
--- Begin Message ---
Does anyone know if it is possible to use the 

'global $varName'

function with the '$GLOBALS' array itself.

I have been having some trouble with this. I have decieded to switch of 
register_globals in the php.ini file (seeing as
it is now deprecated in version 4.1.0)
I know that register_globals is still supported, but I would like to get used to not 
using it.
But anyway, the problem I am having is that when I post data from a form to another 
page the data is not available
globally, so I wrote a method to register them globally, it looks like this

function globaliseVars($varArray) {
        global $GLOBALS;

        while (list($varName,$var) = each($varArray)) {
                $GLOBALS[trim($varName)] = trim($var);
        }
}

But doing 'global $GLOBALS' doesn't seem to make it refer to the actual '$GLOBALS' 
array, the only time it did work was
when I place something into the '$GLOBALS' array on the page that calls the function. 
So

/**
* This doesn't work
*/
globaliseVars($HTTP_POST_VARS);


/**
* But this does
*/
$GLOBALS["ANYTHING"] = "anything";
globaliseVars($HTTP_POST_VARS);

If anyone could help me with this problem please could they get in touch, because its 
driving me crazy.

Thanks!

==============
Philip MacIver           
--- End Message ---
--- Begin Message ---
Why aren't you using the $_POST or $HTTP_POST_VARS array?

--
Gaylen
[EMAIL PROTECTED]
Home http://www.gaylenandmargie.com/
PHP KISGB v2.6 Guest Book http://www.gaylenandmargie.com/phpwebsite/

"Philip Maciver" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Does anyone know if it is possible to use the
>
> 'global $varName'
>
> function with the '$GLOBALS' array itself.
>
> I have been having some trouble with this. I have decieded to switch of
register_globals in the php.ini file (seeing as
> it is now deprecated in version 4.1.0)
> I know that register_globals is still supported, but I would like to get
used to not using it.
> But anyway, the problem I am having is that when I post data from a form
to another page the data is not available
> globally, so I wrote a method to register them globally, it looks like
this
>
> function globaliseVars($varArray) {
> global $GLOBALS;
>
> while (list($varName,$var) = each($varArray)) {
> $GLOBALS[trim($varName)] = trim($var);
> }
> }
>
> But doing 'global $GLOBALS' doesn't seem to make it refer to the actual
'$GLOBALS' array, the only time it did work was
> when I place something into the '$GLOBALS' array on the page that calls
the function. So
>
> /**
> * This doesn't work
> */
> globaliseVars($HTTP_POST_VARS);
>
>
> /**
> * But this does
> */
> $GLOBALS["ANYTHING"] = "anything";
> globaliseVars($HTTP_POST_VARS);
>
> If anyone could help me with this problem please could they get in touch,
because its driving me crazy.
>
> Thanks!
>
> ==============
> Philip MacIver


--- End Message ---
--- Begin Message ---
* Todd Cary ([EMAIL PROTECTED]) [Dec 23. 2001 10:42]:

> I am quite new to the Linux environment and do not have experience with
> "make" files.  The platform is RH Linux 7.2 with the included Apache and
> the PHP rpm, "php-devel-4.0.4pl1-9.i386.rpm".  I need someone to give me
> the step by step process of creating a version of Apache that will
> process PHP extensions.

That's a tall order without knowing exactly what's what with your 
system. :-)

> Many thanks..........

<http://www.php.net/manual/en/install.unix.php>

Which isn't exactly what you want..

And see the comments here:

<http://www.php.net/manual/en/install.linux.php>

I can tell you that you will have problems. It's all a part of the
learning process. No two systems are likely to be the same when it comes
to installing this stuff.

The RPMs with -devel aren't the precompiled "Ready made" executables.

These may also help:

<http://www.devshed.com/Server_Side/PHP/SoothinglySeamless/page1.html>
<http://www.efn.org/~rzeller/mysql/mysql-etc.txt>

I would suggest learning to install all of this stuff from source
archives, rather than depending on RPMs, for the first time.

I know all of the above is kinda spotty, but I hope it gets you started.

-- 
Brian Clark | Avoiding the general public since 1805!
Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8
All you will ever be you are now becoming.

--- End Message ---
--- Begin Message ---
Hiya !

I am working on a download script right now,
and I have a question about a part of my code:

do
{
 $random_ID = rand(1000000000,9999999999);
 $download_dir = "$today $random_ID";
 if (!@is_dir($download_dir))
 mkdir("$download_dir",0777);
}while(@!is_dir($download_dir));

So, I do this loop till the rand command generates a
ID which isn´t already in use ...
So I have now 2 calls of is_dir onto the same directory
in one loop. What do you think:
Do I need to use clearstatcache() or not ?

thx for any comments !

And Merry XMas !!


--- End Message ---
--- Begin Message ---
I do the same with is_file() in several scripts and it works just fine
without clearing the cache. Don't know about dirs but I can't see why it may
be different - should use the exact same functions internally.

On a side note, I'd rather recommend using a loop like
<?
  global $mytmpdir; // usually "/tmp" -- you set this as you please globally

  $dd_prefix="$mytmpdir/temp_download_[project name here]";
  $i=0;
  while (is_dir("$dd_prefix$i))
  {
    $i++;
  }
  mkdir("$dd_prefix$i);
?>

This way you have better control over the number of temp directories
created, use the "official" temp directory and may use the same temp
directory for several projects and still know which dir is used by what
project.

HTH

Bogdan

"Daniel Urstöger" wrote:

> Hiya !
>
> I am working on a download script right now,
> and I have a question about a part of my code:
>
> do
> {
>  $random_ID = rand(1000000000,9999999999);
>  $download_dir = "$today $random_ID";
>  if (!@is_dir($download_dir))
>  mkdir("$download_dir",0777);
> }while(@!is_dir($download_dir));
>
> So, I do this loop till the rand command generates a
> ID which isn´t already in use ...
> So I have now 2 calls of is_dir onto the same directory
> in one loop. What do you think:
> Do I need to use clearstatcache() or not ?
>
> thx for any comments !
>
> And Merry XMas !!
>
> --
> 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]

--- End Message ---
--- Begin Message ---
Forgot a couple of double quotes and the mode for mkdir. Perfectionist, you
see... :-)

Bogdan

<?
  global $mytmpdir; // usually "/tmp" -- you set this as you please globally

  $dd_prefix="$mytmpdir/temp_download_[project name here]";
  $i=0;
  while (is_dir("$dd_prefix$i"))
  {
    $i++;
  }
  mkdir("$dd_prefix$i",0777);
?>


--- End Message ---
--- Begin Message ---
thx for your help !
Since I am the only one who works on the whole server, it´s all my stuff :)
Yeah, but the increasing of the random_ID is surely a good way ..
Will check on that !

thx again ! :))


--- End Message ---
--- Begin Message ---
Hi!
I have 2 types of images :PNG and Jpeg. They are w/o extension (its name 
generated by tempnam and it is exported from DB). How can i show the both 
in one script?
I tryed like this, but it doesn't work(i see one type, and error on 
another):
$im = ImageCreateFromJpeg($picname);
$text="Some text";
if($im)
{
  $nsi= ImageColorAllocate($im,255,190,0);
  ImageString($im,3,0,0,$text,$nsi);
  Header("Content-type: image/jpeg");
  ImageJpeg($im);
  ImageDestroy($im);
}
else
{
  $im = ImageCreateFromPNG($picname);
  $nsi= ImageColorAllocate($im,255,190,0);
  ImageString($im,3,0,0,$text,$nsi);
  Header("Content-type: image/png");
  ImagePng($im);
  ImageDestroy($im);
}

--- End Message ---

Reply via email to