php-general Digest 11 Mar 2001 00:51:06 -0000 Issue 559

Topics (messages 43302 through 43348):

Re: Combo Box containing field
        43302 by: Don Read

Including file...
        43303 by: Martin Hughes

Variable scope
        43304 by: Martin Skjöldebrand
        43305 by: Christian Joergensen

send HTML page from web page using PHP
        43306 by: Paul Godard

Extensions
        43307 by: seb

Opening/closing a DB
        43308 by: Todd Cary
        43326 by: Daniel Grace

Classes and Kernel CPU Load?
        43309 by: Jens Kisters
        43325 by: Christian Reiniger

Sending "pretty" email
        43310 by: Todd Cary
        43332 by: Monte Ohrt
        43345 by: Derek Sivers

Re: Advanced PHP (Please Read)
        43311 by: Dennis Gearon

Re: How to protect my scripts ???
        43312 by: Dennis Gearon
        43344 by: Derek Sivers

Send Mail Problem
        43313 by: seojuyung

UTF
        43314 by: Dennis Gearon
        43348 by: Yasuo Ohgaki

Re: oohform validation help
        43315 by: Dennis Gearon

Re: some array help :)
        43316 by: rm
        43317 by: Jørg Vidar Bryne

Cookies creating Unwanted Problem....
        43318 by: Dhaval Desai

a solution for getmxrr() and Windows?
        43319 by: Keijo Lehto

Re: PHP and the MIME type - an Apache question
        43320 by: Kelly Corkill

Using Cookies
        43321 by: Todd Cary

reloading a webpage?
        43322 by: Fai
        43323 by: Matte
        43324 by: OliNether

MySQL problem - stumped
        43327 by: John Vanderbeck
        43328 by: Rick St Jean
        43329 by: Ernest E Vogelsinger
        43331 by: John Vanderbeck
        43334 by: Julian Wood
        43335 by: Matt Williams
        43336 by: Christian Reiniger
        43337 by: John Vanderbeck
        43338 by: John Vanderbeck

session end
        43330 by: deco

List of all installed fonts on a system??
        43333 by: Andre Bajew

Testing for session without setting cookies
        43339 by: Simon Woods

objects in functions?
        43340 by: Peter Van Dijck
        43343 by: Jørg Vidar Bryne

MkDir failed (Permission denied)
        43341 by: Dan Pupek
        43342 by: Colin May

PHP/MySQL Question
        43346 by: Kath
        43347 by: Cal Evans

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]


----------------------------------------------------------------------


On 10-Mar-01 RealGM wrote:
> Hi,
> 
> Does anyone know how I can create a combo box in my php file that reads the
> options in from a database field?
> 
> I can create combo boxes fine containing values that I enter, but I want it
> to read the values from the database into the drop down box for the user to
> select.
> 
> Thanks,
> Michael.
> 

function selectoption($k, $v, $comp) {
    printf("<OPTION VALUE=\"%s\" %s>%s</OPTION>\n", 
      $k, $comp == $k ? "SELECTED" :"", $v);
}

    $qry="select id,name)
      from country order by name";
    $dbres = @mysql_query($qry);
    if ($dbres) {
        echo '<SELECT NAME=country SIZE="5">';
        while ( $row = mysql_fetch_object($dbres))  {
            selectoption($row->id, $row->name, $usercountry);
        }
        echo "</SELECT>\n";
    }

Regards,
-- 
Don Read                                         [EMAIL PROTECTED]
-- If you are going to sin, sin against God, not the bureaucracy. 
                  God will forgive you but the bureaucrats won't. 




I seem to be making a mistake somewhere...


# Define the navigation bar array
$navbar = array("navmain", "info", "music", "orch", "synth", "syntype",
"audio", "recordings");

# Define the pages in arrays by section
$main = array("home");
$info = array("infomain", "about", "contact", "guestbook");
$music = array("musicmain", "musprologue", "mus1", "mus2", ......, "mus28",
"musepilogue", "musbows", "musplayout");
$orch = array("orchmain", "strings", "brass", "woodwind", "percussion",
"rhythm");
$synth = array("synthmain", "part", "patches");
$synthtype = array("synthtypemain", "dx7", "k2000", "k2vx", "k2500");
$audio = array("audiomain", "synth");
$recordings = array("recordingsmain", "reccompare", "olc", "obc", "csr",
"tac", "lon97");

# Store the arrays in an array
$sections = array("&$main", "&$info", "&$music", "&$orch", "&$synth",
"&$synthtype", "&$audio", "&$recordings")

# Create the name of the .inc file
$pagename = $sections[$sect][$page]; # *******THIS LINE IS CAUSING A PARSE
ERROR*******
$navname = $navbar[$nav];


I then want to include the file $pagename.inc in the main frame, and
$navname.inc in side.php


Cheers,


Martin :0)

==============================================
Musical Director
University of York Gilbert & Sullivan Society
177 Hull Road, York YO10 3JY
01904 427 537 / 07951 015 220
[EMAIL PROTECTED]
http://www.mixermanic.co.uk
==============================================





How do I make a variable persistent between webpages?

V e r b a l




-----Original Message-----
From: Martin Skjoldebrand [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 10, 2001 3:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Variable scope

> How do I make a variable persistent between webpages?

Take a look at the session functions described at:
<http://php.net/manual/en/ref.session.php>

--
Christian Jorgensen
http://www.razor.dk





Hi,

I am absolutely new to PHP, so please excuse my "first" question to the list...

I want to allow visitors of one of my site to send a formatted HTML 
page incl images to an email address of their choice.

So far, I found some guidelines to write my first script but...

I have created a simple page @ 
http://www.gondwanastudio.com/xTest/EmailThisPage.html, where there 
is a button that triggers 
http://www.gondwanastudio.com/Alpha/MailPage.php3 script.

The script grabs the email address from the "from" field and send the 
HTML page to the "to" field  (with table & image) embedded into the 
body of the message.  This seems to work fine but...

My first problem is that the HTML file is not showing "as html" in 
Eudora 5 for Mac although it's capable of it.

Also ideally, I would like that the visitor doesn't see the HTML page 
I am going to send, but only grab the HTML file and send it.

Last, I also would like to send a second email to myself to inform me 
that someone (from) has sent the page someone else (to).  That 
doesn't seem to work.

Your help will be very much appreciated here in South Africa... Thanks!
-- 

Regards, Paul.

Gondwana
[EMAIL PROTECTED]
http://www.gondwanastudio.com




I'm looking for a nice step by step man on the internet to make my own php
extension.I've been trying for days now to make and compile my extensions,
but it seems impossible.

Thanks, Seb






I have some questions about PHP and it's interaction with a DB (namely,
Interbase).  My client's application uses a DB extensively and I am not
clear about opening and closing a DB -  the price one pays.

First, I notice that the approximate time to open a connection to my DB
on my test system is 1 second with a "locate time" of another second.
So, 50% of the time is opening the DB.  Now the structure of the
application is such that the user may enter a page and a parameter is
checked.  Then depending on the results, the page is re-entered and
another DB access is made, etc..  Each time an open and close is
needed.  Is there some method you experienced programmers use to
minimize this?  And every page requires at least one DB access.

The next question envolves closing the DB and returning memory.

    ibase_free_result;
    ibase_close($dbh);

What will happen if in my code I forget to do this in a place or two?
Will the system eventually crash?  I am not saying that I have
intentually done this, *but* I may have left a DB open in a branching
situation or just overlooked doing it in some place.

Trying to learn..............

Todd

--
Todd Cary
Ariste Software
[EMAIL PROTECTED]






On Saturday, March 10, 2001 at 7:03 AM, Todd Cary <[EMAIL PROTECTED]>
wrote:

> I have some questions about PHP and it's interaction with a DB (namely,
> Interbase).  My client's application uses a DB extensively and I am not
> clear about opening and closing a DB -  the price one pays.
>
> First, I notice that the approximate time to open a connection to my DB
> on my test system is 1 second with a "locate time" of another second.
> So, 50% of the time is opening the DB.
-- snip --

I haven't used Interbase, but if it's like most of PHP's database
interfaces, it isn't too critical to worry about closing the database
connection. PHP will do so automatically when your script ends.

-- unsnip --
>
> The next question envolves closing the DB and returning memory.
>
>     ibase_free_result;
>     ibase_close($dbh);
>
> What will happen if in my code I forget to do this in a place or two?
> Will the system eventually crash?
-- snip --

The Interbase extensions to PHP support persistent connections:
http://www.php.net/manual/en/function.ibase-pconnect.php (see
mysql_pconnect() as well for more general info on persistent connections).
With persistent connections, the overhead in connecting to the database
backend is minimized since the same connection can be shared across multiple
pages. This won't work with the CGI version of PHP however.

 - Daniel Grace <http://dewin.oldbattery.com/>

  "Space may be the final frontier but its made in a Hollywood basement."
    - Red Hot Chili Peppers - Californication







I have Scripts that seem to cause imense Kernel (not user) CPU Load
under Solaris,
could this be caused by using classes?

I already removed use of md5() and crypt() from the scripts no change so
far.
What else could cause an immense increase in Kernel CPU Load?

tks
Jens
--
Grüße aus dem schönen Kleve
Jens Kisters

rosomm et partner
Agentur für neue Medien GmbH
Dienstleistungszentrum am
Weißen Tor - Eingang B
Gocher Landstrasse 2
47551 Kleve / Bedburg-Hau

Telefon: 02821 - 97856-20
Telefax: 02821 - 97856-77
[EMAIL PROTECTED]
http://www.rosomm-partner.de






On Saturday 10 March 2001 16:24, you wrote:
> I have Scripts that seem to cause imense Kernel (not user) CPU Load
> under Solaris,
> could this be caused by using classes?

That would be very strange. I rely heavily on classes, and have 
absolutely no problems with them.

> What else could cause an immense increase in Kernel CPU Load?

Try removing more stuff to narrow things down a bit.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka", but "That's funny..."

- Isaac Asimov




I often receive email from commercial sites (e.g. ZDnet) that looks like
a Web page.  How can I do that with Sendmail in PHP?

Todd

--
Todd Cary
Ariste Software
[EMAIL PROTECTED]






Send e-mail headers:

Content-Type: text/html; charset=us-ascii    
Content-Transfer-Encoding: 7bit


Then in the body, put your HTML.

Todd Cary wrote:
> 
> I often receive email from commercial sites (e.g. ZDnet) that looks like
> a Web page.  How can I do that with Sendmail in PHP?
> 
> Todd
> 
> --
> Todd Cary
> Ariste Software
> [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]

--
Monte Ohrt <[EMAIL PROTECTED]>
http://www.ispi.net/





>I often receive email from commercial sites (e.g. ZDnet) that looks like
>a Web page.  How can I do that with Sendmail in PHP?


The man page for "mail" gives an example of it.

http://www.php.net/mail

It's just one "$header" line, stating HTML, then the rest of your message 
should be in HTML:

<html><body>
<h1>Hello Todd!</h1>
<p>Thank you for your can of worms.</p>


Of course I recommend spacing out your HTML so that people without HTML 
capabilities can still make good sense of it.






My mother didn't teach me much about life, nor my Dad. So, after
socially getting the equivalent of brick marks on my forehead from
banging against the brick wall of ignorance, I eventually watched how
people I admired conducted themselves around others. I observed this:

DON'T talk in public or try to get others to see your way about:
1/ Religion
2/ How children should be raised and how many to have.
3/ Money and how it supposed to be used
4/ Politics
5/ Gender Definitions, what **I** or **YOU** think a man should
      be or woman should be
6/ Sex, how, what when where, with who, how often, what accessories to
use,
      and in reference to my part as defined in (5) above.

NOT good dinner conversation at:
A/ The In-laws
B/ Your boss's New Year's eve party.

AT YOUR JOB
Most likely to get you labeled a 'weirdo' and have rumors spread by the 
women that you might be dangerous, i.e. do the prep work to get you
accused of sexual harassment.

ON LIST SERVES
Almost always off topic and a waste of bandwidth and possibly a selfish
abuse of a slightly captive audience, (i.e. we ARE reading this to find
other necessary information)

*****************************
In MARRIAGE
*****************************
Topics You BETTER DAMN WELL TALK ABOUT before ##GETTING## married. Just
imagine permanently disagreeing completely with your partner about any
of those six, or having your partner always trying to change you on any
of them.
-- 
________________________________________________________________
Sites by friends of mine: http://www.myhiddentreasures.com/
________________________________________________________________
WARNING personal propaganda signature
TAKE WHAT YOU LIKE AND LEAVE THE REST

SINCE OUR GOVERNMENT WON'T PRESERVE OUR CLIMATE, IT'S UP TO US!
Imagine ** yourself ** and your kids now an endangered species
<1>Inflate automobile tires to near maximum in summer, -2psi in winter
<2>add insulation to house and hot water heater, and refrigerator,
<3>combine trips in cars, make less of them <4>buy cars, sports
vehicles and recreational vehicles with good if not best mileage
<4>put awnings over windows is summer, remove in winter. <5> add
solar hot water heating. <6>Push for energy recycling clothes
dryers <7> walk more, play outside with your kids! <8> let your
grass grow to 3-4 inches, chokes weeds, saves water and energy,
keeps house cooler <9> Put WHITE or REFLECTIVE materials on
roofs to send energy back into space. <10> Vote for burial of
logging slash onsite in logging areas for better watersheds
and less burned vegetation. <11> compost your leaves and grass,
bury in flower beds, lawns, gardens, or give away. <12> VOTE
for energy and CO2 ratings on ALL products and foods. KNOW how
much damage your purchases do to the climate. <13> Give your kids 
less stuff and more of you. <14> recycle everything you can <15>
limit your children to an average 1 per adult between all your 
marriages. (Only REPLACE yourself, not expand the population)




Can't the files be put into a directory that Apache has access to and
the users don't, and just ask the users to include them? Or put them
into a global prepend in a directory same as above?
-- 
________________________________________________________________
Sites by friends of mine: http://www.myhiddentreasures.com/
________________________________________________________________
WARNING personal propaganda signature
TAKE WHAT YOU LIKE AND LEAVE THE REST

SINCE OUR GOVERNMENT WON'T PRESERVE OUR CLIMATE, IT'S UP TO US!
Imagine ** yourself ** and your kids now an endangered species
<1>Inflate automobile tires to near maximum in summer, -2psi in winter
<2>add insulation to house and hot water heater, and refrigerator,
<3>combine trips in cars, make less of them <4>buy cars, sports
vehicles and recreational vehicles with good if not best mileage
<4>put awnings over windows is summer, remove in winter. <5> add
solar hot water heating. <6>Push for energy recycling clothes
dryers <7> walk more, play outside with your kids! <8> let your
grass grow to 3-4 inches, chokes weeds, saves water and energy,
keeps house cooler <9> Put WHITE or REFLECTIVE materials on
roofs to send energy back into space. <10> Vote for burial of
logging slash onsite in logging areas for better watersheds
and less burned vegetation. <11> compost your leaves and grass,
bury in flower beds, lawns, gardens, or give away. <12> VOTE
for energy and CO2 ratings on ALL products and foods. KNOW how
much damage your purchases do to the climate. <13> Give your kids 
less stuff and more of you. <14> recycle everything you can <15>
limit your children to an average 1 per adult between all your 
marriages. (Only REPLACE yourself, not expand the population)





>Can't the files be put into a directory that Apache has access to and
>the users don't, and just ask the users to include them? Or put them
>into a global prepend in a directory same as above?


This isn't PERFECT, but I do this:

#1 - make a user/group called "www"

#2 - Set Apache to run as that user.

#3 - chmod all web-directories to 700 permission  (chown www:www -R *; 
chmod 700 -R *) - so that ONLY "www" can read/write them.

#4 - log in as "www" user when you're uploading files to your webserver.






Hello

I'm PHPer in Korea.

Now I have a problem with mail function.
I used it many times and it worked very well.
But it has a problem today !

When I use mail() function in a PHP web page, it took too many times to show that web 
page like sleep.
Mail function returns some values so I guess it worked well.
But mail transfer was not done !

So I tried to restart Sendmail, Apache but it didn't make any differences . Oops!
What I have to do to solve this problem ?

It's a strange problem.





Is there any UTF-8 r UTF-32 compatibility in PHP? I want to be
multinational with the SAME scripts, not a dozen. I haven't tried
anything yet, just asking

-- 
________________________________________________________________
Sites by friends of mine: http://www.myhiddentreasures.com/
________________________________________________________________
WARNING personal propaganda signature
TAKE WHAT YOU LIKE AND LEAVE THE REST

SINCE OUR GOVERNMENT WON'T PRESERVE OUR CLIMATE, IT'S UP TO US!
Imagine ** yourself ** and your kids now an endangered species
<1>Inflate automobile tires to near maximum in summer, -2psi in winter
<2>add insulation to house and hot water heater, and refrigerator,
<3>combine trips in cars, make less of them <4>buy cars, sports
vehicles and recreational vehicles with good if not best mileage
<4>put awnings over windows is summer, remove in winter. <5> add
solar hot water heating. <6>Push for energy recycling clothes
dryers <7> walk more, play outside with your kids! <8> let your
grass grow to 3-4 inches, chokes weeds, saves water and energy,
keeps house cooler <9> Put WHITE or REFLECTIVE materials on
roofs to send energy back into space. <10> Vote for burial of
logging slash onsite in logging areas for better watersheds
and less burned vegetation. <11> compost your leaves and grass,
bury in flower beds, lawns, gardens, or give away. <12> VOTE
for energy and CO2 ratings on ALL products and foods. KNOW how
much damage your purchases do to the climate. <13> Give your kids 
less stuff and more of you. <14> recycle everything you can <15>
limit your children to an average 1 per adult between all your 
marriages. (Only REPLACE yourself, not expand the population)




Hello Dennis,

It seems what you need is gettext/recode module to me. How about read PHP manul
for these moduels?

Anyway, XML should use UTF-8 for charset and you should be able to use UTF-8 w/o
any problems in your script and html, too.

> Is there any UTF-8 r UTF-32 compatibility in PHP? I want to be
> multinational with the SAME scripts, not a dozen. I haven't tried
> anything yet, just asking

Try gettext for multi language support.

Regards,
Yasuo Ohgaki

>
> --
> ________________________________________________________________
> Sites by friends of mine: http://www.myhiddentreasures.com/
> ________________________________________________________________
> WARNING personal propaganda signature
> TAKE WHAT YOU LIKE AND LEAVE THE REST
>
> SINCE OUR GOVERNMENT WON'T PRESERVE OUR CLIMATE, IT'S UP TO US!
> Imagine ** yourself ** and your kids now an endangered species
> <1>Inflate automobile tires to near maximum in summer, -2psi in winter
> <2>add insulation to house and hot water heater, and refrigerator,
> <3>combine trips in cars, make less of them <4>buy cars, sports
> vehicles and recreational vehicles with good if not best mileage
> <4>put awnings over windows is summer, remove in winter. <5> add
> solar hot water heating. <6>Push for energy recycling clothes
> dryers <7> walk more, play outside with your kids! <8> let your
> grass grow to 3-4 inches, chokes weeds, saves water and energy,
> keeps house cooler <9> Put WHITE or REFLECTIVE materials on
> roofs to send energy back into space. <10> Vote for burial of
> logging slash onsite in logging areas for better watersheds
> and less burned vegetation. <11> compost your leaves and grass,
> bury in flower beds, lawns, gardens, or give away. <12> VOTE
> for energy and CO2 ratings on ALL products and foods. KNOW how
> much damage your purchases do to the climate. <13> Give your kids
> less stuff and more of you. <14> recycle everything you can <15>
> limit your children to an average 1 per adult between all your
> marriages. (Only REPLACE yourself, not expand the population)
>
> --
> 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]
>
>




This sounds like a good idea for a PHP 'NetZip'(tm) rip-off. Anyone made
a PHP/JavaScript upload, download program(s) that sends data in chunks,
does
error checking on the chunks, keeps track of the download process, can
pause,
all the Netzip stuff? (And NetZip has some problems, as well as there's
been
a rumor that they do something with cookies or other data and sell it
without
your permission) I.E. I'm talking about something robust enough to
install a 
cookie or server side client info that lets the process start again when
the MightMS OS crashes and you come back 5 - 10 minutes later.
-- 
________________________________________________________________
Sites by friends of mine: http://www.myhiddentreasures.com/
________________________________________________________________
WARNING personal propaganda signature
TAKE WHAT YOU LIKE AND LEAVE THE REST

SINCE OUR GOVERNMENT WON'T PRESERVE OUR CLIMATE, IT'S UP TO US!
Imagine ** yourself ** and your kids now an endangered species
<1>Inflate automobile tires to near maximum in summer, -2psi in winter
<2>add insulation to house and hot water heater, and refrigerator,
<3>combine trips in cars, make less of them <4>buy cars, sports
vehicles and recreational vehicles with good if not best mileage
<4>put awnings over windows is summer, remove in winter. <5> add
solar hot water heating. <6>Push for energy recycling clothes
dryers <7> walk more, play outside with your kids! <8> let your
grass grow to 3-4 inches, chokes weeds, saves water and energy,
keeps house cooler <9> Put WHITE or REFLECTIVE materials on
roofs to send energy back into space. <10> Vote for burial of
logging slash onsite in logging areas for better watersheds
and less burned vegetation. <11> compost your leaves and grass,
bury in flower beds, lawns, gardens, or give away. <12> VOTE
for energy and CO2 ratings on ALL products and foods. KNOW how
much damage your purchases do to the climate. <13> Give your kids 
less stuff and more of you. <14> recycle everything you can <15>
limit your children to an average 1 per adult between all your 
marriages. (Only REPLACE yourself, not expand the population)




I'm not exactly sure of what you're doing, however, if
you're trying to find a match to an element of an
array and if there's a match do something....you might
try....

for ($i=0; $i < count($temparray); $i++){

if ($temparray[$i] == "something"){
    do whatever this and that;
}
}

rm
--- Gregor Jaksa <[EMAIL PROTECTED]> wrote:
> hello,
> 
> i'm trying to do something like
> 
> $tmparray = array("foo", "foo1", "foo2");
> if ($i in $tmparray) then do something
> ..
> but i dont know how to do it.
> any help would be appriciated
> 
> 
> 
> -- 
> 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]
> 


=====


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/




Or you could use this in php4:

if ( in_array( "something", $temparray  )) { do stuff }

-J

----- Original Message ----- 
From: "rm" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 10, 2001 4:54 PM
Subject: Re: [PHP] some array help :)


> I'm not exactly sure of what you're doing, however, if
> you're trying to find a match to an element of an
> array and if there's a match do something....you might
> try....
> 
> for ($i=0; $i < count($temparray); $i++){
> 
> if ($temparray[$i] == "something"){
>     do whatever this and that;
> }
> }
> 
> rm
> --- Gregor Jaksa <[EMAIL PROTECTED]> wrote:
> > hello,
> > 
> > i'm trying to do something like
> > 
> > $tmparray = array("foo", "foo1", "foo2");
> > if ($i in $tmparray) then do something
> > ..
> > but i dont know how to do it.
> > any help would be appriciated
> > 
> > 
> > 
> > -- 
> > 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]
> > 
> 
> 
> =====
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices.
> http://auctions.yahoo.com/
> 
> -- 
> 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]
> 





Hi!


This website is authenticated using cookies.
I don't understand why..? Id works from some computers
and doesn't work from some computers...


The Operating System is Same. The Browser is also the
same one INTERNET EXPLORER 5.0.


Is there any reason why this is happening.

Checck out this website URL for details.

http://www.uaegraduate.com/jobseekers_login.php
Username: testing
Password: testing

I have used cookies to autheticate on this one.


Thank You
Dhaval Desai





__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/




Hello,

I've read the archieves and saw other people being frustrated on the same
thing that I've been working on during the last couple of days.

As PHP cannot correctly get mx records on windows, I've decided to open a
socket to a name server and do the stuff manually with fputs&fgets. However,
I have no idea what I should say to the server and what to expect as a
reply. As a matter of fact, I don't even know what is (usually) the port
used.

So if anyone could help me by explaining things a bit or giving some URL's
to read I'd appreciate it awfully lot.

Sinc, Keijo

PS. I know the interaction with a name server is not PHP specific thingie,
but as this is a common problem with PHP, I think this could help some
others, too.







Not at all unusual. Serve the pages as php (or .phtml, whatever
you tell your servers re: file extensions and mime type).

Then get acquainted with includes or require:

http://www.php.net/manual/en/function.include.php
http://www.php.net/manual/en/function.require.php


The server will "include" or "require" (big difference, one can be
conditional, one can not be looped etc) the relevant link/action on
presentation.

We use includes for repeated navigational elements, form insertion, option
lists, etc. Same can be true of executables within php.

On Sat, 10 Mar 2001, Richard S. Crawford wrote:

> Date: Sat, 10 Mar 2001 00:47:01 -0800
> From: Richard S. Crawford <[EMAIL PROTECTED]>
> To: Kelly Corkill <[EMAIL PROTECTED]>,
>      Richard S. Crawford <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] PHP and the MIME type - an Apache question
> 
> Ah, sorry.
> 
> Here's the deal.  Our company runs Unix on Sun Solaris (sorry, don't know 
> the numbers of the top of my head) servers.  We have Apache set up to go 
> through every HTML file which is served, and look for instances of a 
> particular command.  For example, in our HTML files, we might have commands 
> such as "<BOB-include>" or something.  When an HTML file is served, Apache 
> calls a Perl module called parser.cgi which goes through the file and 
> executes the BOB commands; in this case, the BOB-include command might mean 
> to include a certain file, sort of like the PHP include command.
> 
> While this system is good for specific database needs, it doesn't allow a 
> large degree of flexibility, which is why we're beginning to explore using 
> PHP to create complex scripts.  What I would like to do is be able to 
> include the BOB commands in the output of a PHP script -- say, in a print() 
> command -- and have those BOB commands executed.
> 
> I hope this makes sense.  I'm trying to be as clear as possible without 
> giving away any sensitive company information.
> 
> Richard
> 
> 
> At 07:51 PM 3/9/01 -0700, Kelly Corkill wrote:
> >I think it might help if you elaborated a little more on what you mean by
> >"parse out all of my PHP scripts to run a particular CGI script".
> >
> >Apache has to be set up so know how to handle php (mime types), but it
> >almost sounds like you're trying to execute a CGI in place of a php file?
> >
> >Also, if this IS a question related to apache what operating system? Makes a
> >big diff.
> 
> --
> http://www.mossroot.com/index.php
> AIM Handle: Buffalo2K
> e-mail: [EMAIL PROTECTED]
> "When you lose the power to laugh at yourself, you lose the power to think 
> straight."  --Clarence Darrow
> 

Kelly

303-444-1671
Boulder, Colorado







This is a test script so I can get an understanding of Cookies.  What am
I missing with this?  $cookieuser never gets a value.

<?
  $user       = $HTTP_GET_VARS[user];
  $pw         = $HTTP_GET_VARS[pw];
  $cookieuser = $HTTP_COOKIE_VARS[user];
  if (!$cookieuser) {
    setcookie("user", $user, time() + 864000);
    print("Setting a cookie<br>");
  }

  print("The user is " . $user . "<br>");
  print("The password is " . $pw . "<br>");
  if (empty($cookieuser)) {
    print("No cookie was set...will set one<br>");
  } else {
    print("Cookie user name: " . $cookieuser . "<br>");
  }
?>



--
Todd Cary
Ariste Software
[EMAIL PROTECTED]






Does any body know how to ensure the web page will clear the previous
history (cache) and reload the new data when the same webpage re-displays to
browser?

That is the current webpage content is based on previous webpage input, and
when we press "back" button to re-enter previous webpage input then we press
"forward" and this current page will know to update the content and display
new one to browser.






header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
                                                      // always modified
header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1
header ("Pragma: no-cache");                          // HTTP/1.0

-----Ursprungligt meddelande-----
Från: Fai [mailto:[EMAIL PROTECTED]]
Skickat: den 10 mars 2001 18:25
Till: [EMAIL PROTECTED]
Ämne: [PHP] reloading a webpage?


Does any body know how to ensure the web page will clear the previous
history (cache) and reload the new data when the same webpage re-displays to
browser?

That is the current webpage content is based on previous webpage input, and
when we press "back" button to re-enter previous webpage input then we press
"forward" and this current page will know to update the content and display
new one to browser.



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






Hi, I think you could use headers to prevent the browser from
caching the page, for example :

  header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
  header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
  header('Cache-Control: no-cache, must-revalidate');
  header('Pragma: no-cache');

Take a look at what the manual says about headers, i'm not just
this code is accurate, but thats the idea.

HTH,

-- OliNether.

"Fai" <[EMAIL PROTECTED]> wrote :
>
> Subject: [PHP] reloading a webpage?
>

> Does any body know how to ensure the web page will clear the previous
> history (cache) and reload the new data when the same webpage re-displays to
> browser?
> 
> That is the current webpage content is based on previous webpage input, and
> when we press "back" button to re-enter previous webpage input then we press
> "forward" and this current page will know to update the content and display
> new one to browser.
> 






The following code is giving an me problems, I can't figure it out to save
my soul.  The last line gives:

Here is the code:

$link = db_connect();
$query = "UPDATE Users SET firstname='$firstname', lastname='$lastname'
WHERE username='$user' && password='$password'";
$result = mysql_query($query, $link);
$err = mysql_error();
echo "Errors:".$err;
$rows = mysql_affected_rows($result);

And here is the output:
Errors:
Warning: Supplied argument is not a valid MySQL-Link resource in
/****/*****/****/**********.********.***/db.php on line 147

Line 147, is the last line in the above snippet.  I cleared out the path
name for security, no offense intended :)

Now, I KNOW that the db_connect() function is not the problem, as I use it
in many other places in this script with no errors.  What am I missing?

- John Vanderbeck
- Admin, GameDesign





At 01:58 PM 3/10/01 -0500, John Vanderbeck wrote:


You are using && in your statement ... should be "AND"

.


>The following code is giving an me problems, I can't figure it out to save
>my soul.  The last line gives:
>
>Here is the code:
>
>$link = db_connect();
>$query = "UPDATE Users SET firstname='$firstname', lastname='$lastname'
>WHERE username='$user' && password='$password'";
>$result = mysql_query($query, $link);
>$err = mysql_error();
>echo "Errors:".$err;
>$rows = mysql_affected_rows($result);
>
>And here is the output:
>Errors:
>Warning: Supplied argument is not a valid MySQL-Link resource in
>/****/*****/****/**********.********.***/db.php on line 147
>
>Line 147, is the last line in the above snippet.  I cleared out the path
>name for security, no offense intended :)
>
>Now, I KNOW that the db_connect() function is not the problem, as I use it
>in many other places in this script with no errors.  What am I missing?
>
>- John Vanderbeck
>- Admin, GameDesign
>
>
>--
>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]

##########################################################
#  Rick St Jean,
#  [EMAIL PROTECTED]
#  President of Design Shark,
#  http://www.designshark.com/
#  Quick Contact:  http://www.designshark.com/messaging.ihtml
#  Tel: 905-684-2952
##########################################################





At 19:58 10.03.2001, John Vanderbeck said:
--------------------[snip]--------------------
>$query = "UPDATE Users SET firstname='$firstname', lastname='$lastname'
>WHERE username='$user' && password='$password'";
--------------------[snip]-------------------- 

Try "AND" instead of "&&", this should work as intended...


     ...ebird

   >O     Ernest E. Vogelsinger
   (\)    http://www.1-at-web.at/
    ^     ICQ#   13394035






Ok,

Well I got 3 replies saying that my use of && is incorrect, and that I
should use AND.  This confused me for 2 reasons. First, is that I use && in
all my other SELECT queries, with no problems.  In fact, the MySQL docs,
show the use of &&, not AND. Secondly, because if I had a bad query, it
should have given me some sort of error when I output mysql_error(). No?

However, I did of course try changing it to AND instead of &&.  But the
problem remains.  Same error.
Any other ideas?

- John Vanderbeck
- Admin, GameDesign

> -----Original Message-----
> From: Rick St Jean [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, March 10, 2001 2:09 PM
> To: PHP User Group
> Subject: Re: [PHP] MySQL problem - stumped
>
>
> At 01:58 PM 3/10/01 -0500, John Vanderbeck wrote:
>
>
> You are using && in your statement ... should be "AND"
>
> .
>
>
> >The following code is giving an me problems, I can't figure it
> out to save
> >my soul.  The last line gives:
> >
> >Here is the code:
> >
> >$link = db_connect();
> >$query = "UPDATE Users SET firstname='$firstname', lastname='$lastname'
> >WHERE username='$user' && password='$password'";
> >$result = mysql_query($query, $link);
> >$err = mysql_error();
> >echo "Errors:".$err;
> >$rows = mysql_affected_rows($result);
> >
> >And here is the output:
> >Errors:
> >Warning: Supplied argument is not a valid MySQL-Link resource in
> >/****/*****/****/**********.********.***/db.php on line 147
> >
> >Line 147, is the last line in the above snippet.  I cleared out the path
> >name for security, no offense intended :)
> >
> >Now, I KNOW that the db_connect() function is not the problem,
> as I use it
> >in many other places in this script with no errors.  What am I missing?
> >
> >- John Vanderbeck
> >- Admin, GameDesign
> >
> >
> >--
> >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]
>
> ##########################################################
> #  Rick St Jean,
> #  [EMAIL PROTECTED]
> #  President of Design Shark,
> #  http://www.designshark.com/
> #  Quick Contact:  http://www.designshark.com/messaging.ihtml
> #  Tel: 905-684-2952
> ##########################################################
>
>
> --
> 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]
>






Well, PHP seems to think that $link is not working, so your db_connect() is
in fact, the problem. You say you use db_connect several times in this
script without problem - why do you keep connecting to the same database
repeatedly in the same script - one connection will do for all your queries.

HTH,

Julian

on 3/10/01 12:11 PM, John Vanderbeck at [EMAIL PROTECTED] wrote:

> 
> 
> Ok,
> 
> Well I got 3 replies saying that my use of && is incorrect, and that I
> should use AND.  This confused me for 2 reasons. First, is that I use && in
> all my other SELECT queries, with no problems.  In fact, the MySQL docs,
> show the use of &&, not AND. Secondly, because if I had a bad query, it
> should have given me some sort of error when I output mysql_error(). No?
> 
> However, I did of course try changing it to AND instead of &&.  But the
> problem remains.  Same error.
> Any other ideas?
> 
> - John Vanderbeck
> - Admin, GameDesign
> 
>> -----Original Message-----
>> From: Rick St Jean [mailto:[EMAIL PROTECTED]]
>> Sent: Saturday, March 10, 2001 2:09 PM
>> To: PHP User Group
>> Subject: Re: [PHP] MySQL problem - stumped
>> 
>> 
>> At 01:58 PM 3/10/01 -0500, John Vanderbeck wrote:
>> 
>> 
>> You are using && in your statement ... should be "AND"
>> 
>> .
>> 
>> 
>>> The following code is giving an me problems, I can't figure it
>> out to save
>>> my soul.  The last line gives:
>>> 
>>> Here is the code:
>>> 
>>> $link = db_connect();
>>> $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname'
>>> WHERE username='$user' && password='$password'";
>>> $result = mysql_query($query, $link);
>>> $err = mysql_error();
>>> echo "Errors:".$err;
>>> $rows = mysql_affected_rows($result);
>>> 
>>> And here is the output:
>>> Errors:
>>> Warning: Supplied argument is not a valid MySQL-Link resource in
>>> /****/*****/****/**********.********.***/db.php on line 147
>>> 
>>> Line 147, is the last line in the above snippet.  I cleared out the path
>>> name for security, no offense intended :)
>>> 
>>> Now, I KNOW that the db_connect() function is not the problem,
>> as I use it
>>> in many other places in this script with no errors.  What am I missing?
>>> 
>>> - John Vanderbeck
>>> - Admin, GameDesign
>>> 
>>> 

--
Julian Wood
Learning Technologies and Digital Media
University of Calgary






> > >The following code is giving an me problems, I can't figure it
> > out to save
> > >my soul.  The last line gives:
> > >
> > >Here is the code:
> > >
> > >$link = db_connect();
> > >$query = "UPDATE Users SET firstname='$firstname', lastname='$lastname'
> > >WHERE username='$user' && password='$password'";
> > >$result = mysql_query($query, $link);
> > >$err = mysql_error();
> > >echo "Errors:".$err;
> > >$rows = mysql_affected_rows($result);
> > >
> > >And here is the output:
> > >Errors:
> > >Warning: Supplied argument is not a valid MySQL-Link resource in
> > >/****/*****/****/**********.********.***/db.php on line 147

Hi

OK my thoughts, no disrespect intended.

Is the table Users and not users? Are all the column names correct and are
they really in this tables??

also try
$result = mysql_query($query, $link) or die ($mysql_error())

to see what output mysql is giving as to why the query failed.

As I say no disrespect but you need to go back and try to unsderstand why it
is failing

M@





On Saturday 10 March 2001 19:58, you wrote:
> The following code is giving an me problems, I can't figure it out to
> save my soul.  The last line gives:
>
> Here is the code:
>
> $link = db_connect();
> $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname'
> WHERE username='$user' && password='$password'";
> $result = mysql_query($query, $link);
> $err = mysql_error();
> echo "Errors:".$err;
> $rows = mysql_affected_rows($result);
>
> And here is the output:
> Errors:
> Warning: Supplied argument is not a valid MySQL-Link resource in
> /****/*****/****/**********.********.***/db.php on line 147
>
> Line 147, is the last line in the above snippet.  I cleared out the
> path name for security, no offense intended :)

This one?
> $rows = mysql_affected_rows($result);

Try
$rows = mysql_affected_rows($link);

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra





I do'nt connect multiple times..its one large script that handles different
tasks based on the settings of control vars.  I just like to keep it all
together.  The $link has to be valid, or it would be erroring out on the
mysql_query() call.  Which it is not, and it reports no errors with that
call.

- John Vanderbeck
- Admin, GameDesign

> -----Original Message-----
> From: Julian Wood [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, March 10, 2001 2:28 PM
> To: John Vanderbeck; PHP User Group
> Subject: Re: [PHP] MySQL problem - stumped
>
>
>
> Well, PHP seems to think that $link is not working, so your
> db_connect() is
> in fact, the problem. You say you use db_connect several times in this
> script without problem - why do you keep connecting to the same database
> repeatedly in the same script - one connection will do for all
> your queries.
>
> HTH,
>
> Julian
>
> on 3/10/01 12:11 PM, John Vanderbeck at [EMAIL PROTECTED] wrote:
>
> >
> >
> > Ok,
> >
> > Well I got 3 replies saying that my use of && is incorrect, and that I
> > should use AND.  This confused me for 2 reasons. First, is that
> I use && in
> > all my other SELECT queries, with no problems.  In fact, the MySQL docs,
> > show the use of &&, not AND. Secondly, because if I had a bad query, it
> > should have given me some sort of error when I output mysql_error(). No?
> >
> > However, I did of course try changing it to AND instead of &&.  But the
> > problem remains.  Same error.
> > Any other ideas?
> >
> > - John Vanderbeck
> > - Admin, GameDesign
> >
> >> -----Original Message-----
> >> From: Rick St Jean [mailto:[EMAIL PROTECTED]]
> >> Sent: Saturday, March 10, 2001 2:09 PM
> >> To: PHP User Group
> >> Subject: Re: [PHP] MySQL problem - stumped
> >>
> >>
> >> At 01:58 PM 3/10/01 -0500, John Vanderbeck wrote:
> >>
> >>
> >> You are using && in your statement ... should be "AND"
> >>
> >> .
> >>
> >>
> >>> The following code is giving an me problems, I can't figure it
> >> out to save
> >>> my soul.  The last line gives:
> >>>
> >>> Here is the code:
> >>>
> >>> $link = db_connect();
> >>> $query = "UPDATE Users SET firstname='$firstname',
> lastname='$lastname'
> >>> WHERE username='$user' && password='$password'";
> >>> $result = mysql_query($query, $link);
> >>> $err = mysql_error();
> >>> echo "Errors:".$err;
> >>> $rows = mysql_affected_rows($result);
> >>>
> >>> And here is the output:
> >>> Errors:
> >>> Warning: Supplied argument is not a valid MySQL-Link resource in
> >>> /****/*****/****/**********.********.***/db.php on line 147
> >>>
> >>> Line 147, is the last line in the above snippet.  I cleared
> out the path
> >>> name for security, no offense intended :)
> >>>
> >>> Now, I KNOW that the db_connect() function is not the problem,
> >> as I use it
> >>> in many other places in this script with no errors.  What am
> I missing?
> >>>
> >>> - John Vanderbeck
> >>> - Admin, GameDesign
> >>>
> >>>
>
> --
> Julian Wood
> Learning Technologies and Digital Media
> University of Calgary
>
>





Grr..

Thank You!  God I feel like the idiot now.  Why didn't I see that? Heck why
didn't anyone else see it either :)  I'm so used to using $rows =
mysql_num_rows($result), that I just did the same thing here.  But your
right, the docs say THIS one takes a LINK and not a RESULT identifier. Grr..

Thanks again.  Your a deadline saver :)

- John Vanderbeck
- Admin, GameDesign

> -----Original Message-----
> From: Christian Reiniger [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, March 10, 2001 2:32 PM
> To: PHP User Group
> Subject: Re: [PHP] MySQL problem - stumped
>
>
> On Saturday 10 March 2001 19:58, you wrote:
> > The following code is giving an me problems, I can't figure it out to
> > save my soul.  The last line gives:
> >
> > Here is the code:
> >
> > $link = db_connect();
> > $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname'
> > WHERE username='$user' && password='$password'";
> > $result = mysql_query($query, $link);
> > $err = mysql_error();
> > echo "Errors:".$err;
> > $rows = mysql_affected_rows($result);
> >
> > And here is the output:
> > Errors:
> > Warning: Supplied argument is not a valid MySQL-Link resource in
> > /****/*****/****/**********.********.***/db.php on line 147
> >
> > Line 147, is the last line in the above snippet.  I cleared out the
> > path name for security, no offense intended :)
>
> This one?
> > $rows = mysql_affected_rows($result);
>
> Try
> $rows = mysql_affected_rows($link);
>
> --
> Christian Reiniger
> LGDC Webmaster (http://sunsite.dk/lgdc/)
>
> The use of COBOL cripples the mind; its teaching should, therefore,
> be regarded as a criminal offence.
>
> - Edsger W. Dijkstra
>
> --
> 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]
>
>






  is there some kind of function or event launched when a session times
out??

  something like session_on_end() ??

  i'm using a flag on a database to tell if a user is visiting the page and
i would like to make him offline when his session expires...






Hi,

anyone know of a way to get a list of all installed fonts on a system for
use inside of a combo box?

TIA!
Andre






Hi All,

Sorry if I am asking a vfaq but I was unable to find anything in the 
archives.

I am using PHP4 with session handling to track users which have logged 
in to my server.

I would like to (non intrusively) check to see if a user is logged in 
without having to start a new session. 95% of my users do not log in at 
all and do not want to be fed with cookies for no apparent reason. I 
wanted to avoid giving my visitors the impression that I am tracking 
them as well.

I could check to see if the cookie PHPSESSION or what ever I called my 
cookie has been returned by the browser, but I have no guarantee that 
the session is still or at all valid. Checking to see if there are 
corresponding session files or writing my own handler start to get over 
complicated.

I hope that I have overlooked something.

Thanks in advance,

-- 
Simon Woods

Siemens Business Services
SBS EBS D CKS
Munich Germany 089 / 636 54347





Hi,
I want to make a recursive function generating a hierarchy using a class.

The following code works fine when I don't wrap the function around it,
but when I do it fails. I can't figure out why...
I'm thinking I may need to make some vars global, or maybe you can't use 
objects inside functions? (No, couldn't be)

Here's the code:
.........
$root  = $tree->open_tree ($title, "");

    function generate_nodes($id) {

        $sql = "select * from hierarchy where parent = $id";
        $res = mysql_debug_query($sql);
        while ($row = mysql_fetch_array($res)) {
             $node = "node" . $count;
             $$node = $tree->add_folder ($root, $row["name"] . " <font 
size=1>" . $row["id"] . "</font>", "");

             $count++;
        }
    }
    generate_nodes($id);
........
Thanks for any hints...
Peter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://liga1.com: building multiple language/culture websites





What do you mean by it fails? Any particular error, or does it just time
out?

I've made a different recursive function to print a tree-menu, you can have
a look at it if you want but it might not be what you're after. It prints a
tree-menu, and reqires the table to have at least a field named id and
parent. parent telling which node an object is connected to.
But I guess you know that already, I just got carried away! Maybe someone
could use this.

good night!
:-)

PHP4:

This script makes just one query to the server, fetching the id, parent and
name of each object, so u don't have to make multiple queries. Don't know if
it is any faster, though.


<?
function Recurse( $parent, $level=0, $item_string=0 ) {
 global $expand, $obj;
 $tmp = $obj; reset( $tmp );
 foreach( $tmp as $k=>$v ) {
  if( $v->parent == $parent ) {
   (in_array( $v->id, $expand))?$X="&gt;&nbsp;":$X="&nbsp;&nbsp;&nbsp;";
    echo @str_repeat( "&nbsp;", $level*3 ).
    "$X<a
href='$PHP_SELF?item=".$item_string.",".$v->id."'>$v->item</a><br>";
    if ( in_array( $v->id, $expand ) ) recurse( $v->id, $level +1,
$item_string.",".$v->id );
  }
 }
}
// id = the key, item=the name of an object, and parent=the connected node.
ord is just the order of objects (which i've set in the db)

 $sql = "select id,item,parent from menu order by parent, ord";
 $qry = mysql_query( $sql );
 while( $tmp = mysql_fetch_object( $qry )) { $p = (int) $tmp->id+0; $obj[$p]
= $tmp;}

 $expand = explode( ",", $item ); // expand is an array containing the nodes
to be opened
//(check the URI :-)

 Recurse(0); // start with top-level objects (starting node)
?>

----- Original Message -----
From: "Peter Van Dijck" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 10, 2001 9:43 PM
Subject: [PHP] objects in functions?


> Hi,
> I want to make a recursive function generating a hierarchy using a class.
>
> The following code works fine when I don't wrap the function around it,
> but when I do it fails. I can't figure out why...
> I'm thinking I may need to make some vars global, or maybe you can't use
> objects inside functions? (No, couldn't be)
>
> Here's the code:
> .........
> $root  = $tree->open_tree ($title, "");
>
>     function generate_nodes($id) {
>
>         $sql = "select * from hierarchy where parent = $id";
>         $res = mysql_debug_query($sql);
>         while ($row = mysql_fetch_array($res)) {
>              $node = "node" . $count;
>              $$node = $tree->add_folder ($root, $row["name"] . " <font
> size=1>" . $row["id"] . "</font>", "");
>
>              $count++;
>         }
>     }
>     generate_nodes($id);
> ........
> Thanks for any hints...
> Peter
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> http://liga1.com: building multiple language/culture websites
>
>
> --
> 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]
>





I am pretty new to PHP but have used other scripting languages. I am trying
to use to mkdir() function on an apache server and keep getting this  error
MkDir failed (Permission denied). I don't have physical access to the
server.

What's up?

Thanks in advance for any help.
Dan Pupek

On the Web:
http://www.sunnet.net/dnkp/dan

Email:
[EMAIL PROTECTED]






Quoting Dan Pupek (Sat, Mar 10, 2001 at 02:49:40PM -0600)
> I am pretty new to PHP but have used other scripting languages. I am trying
> to use to mkdir() function on an apache server and keep getting this  error
> MkDir failed (Permission denied). I don't have physical access to the
> server.
> 
> What's up?

Depends what directory you are trying to create, and if the permissions of 
the parent directory allows you to do, based on the user apache is running 
as.  Usually, most people dont run apache as root, normally the "nobody" 
user.   "nobody" tends not to be able to mkdir's unless someone has 
chown'd/chmod'd a parent directory accordingly.

Colin. 

-- 

Colin May                  | "its an illusion, its a game, a reflection of
mailto:[EMAIL PROTECTED]  | someone elses name" - abacab, genesis
http://www.wibble.org.uk   | http://www.abacab.org.uk





Having some problems with syntax.

If I wanted to SELECT only 5 instances of something from a database and order it by 
datetime, how would I do that?

- Kath




Select * from table limit 5;

http://www.calevans.com


-----Original Message-----
From: Kath [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 10, 2001 6:01 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP/MySQL Question


Having some problems with syntax.

If I wanted to SELECT only 5 instances of something from a database and
order it by datetime, how would I do that?

- Kath



Reply via email to