php-general Digest 11 Feb 2006 13:18:42 -0000 Issue 3957

Topics (messages 230233 through 230249):

Re: Static and Global at the same time!
        230233 by: Miguel Guirao

Weirdness with PHP FreeBSD/OSX/Linux headers already sent
        230234 by: Eric Butera
        230238 by: Curt Zirzow
        230239 by: Kevin Kinsey

Re: php versions between os/platform
        230235 by: Kevin Kinsey

Updated PHP Examples
        230236 by: Dave Jarvis

SQL request on DBase file...
        230237 by: David BERCOT
        230243 by: Miles Thompson

Re: <Newbie Question> Can't insert values into MySQL DB via PHP
        230240 by: Kevin Kinsey

how to learn php
        230241 by: /dev/null
        230242 by: Philip Hallstrom
        230245 by: Kim Briggs
        230247 by: Murray . PlanetThoughtful
        230248 by: Weber Sites LTD
        230249 by: Sam Smith

Oracle buying out Zend ... how does that affect PHP?
        230244 by: Marc G. Fournier

Re: Clone of the concurrent users limit of Zend Encoder 4.0 ?
        230246 by: HoWang Wang

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---

Thanks for all your suggestions!! specially to "list"!!

Regards,
Miguel Guirao

-----Original Message-----
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: Viernes, 10 de Febrero de 2006 03:20 p.m.
To: Miguel Guirao
Cc: PHP List
Subject: Re: [PHP] Static and Global at the same time!


On Fri, February 10, 2006 9:07 am, Miguel Guirao wrote:
> Can I have a variable that is static and global at the same time
> within a
> function?
> Let's say I have:
>
> $data = "";
>
> function newdata() {
>   static global $data;
>   $data [$i] = $newdatatobestored_inthearray;
> }

No.

But if you need external access, global is the way to go...

I can't think of any inherent property to 'static' that is not already
encompassed by 'global'...  Am I missing something?

Initializing $data to "" and then adding to it as an array is pretty
ugly code, imho.  Initialize it to an array() not "" if it's an array.

-- 
Like Music?
http://l-i-e.com/artists.htm



Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.

--- End Message ---
--- Begin Message ---
PHP List,

Perhaps one of you might know the answer to this, because I certainly do
not, nor do any of my coworkers.  The "problem" is that scripts on our OSX
10.4 (our local development machines) and RedHat/Debian linux servers do not
throw the "headers already sent" message.  I could have an entire page of
html, php code, whatever I wish and call session_start() at the bottom of
the page and everything would be fine.  No errors on screen, in error_log,
or anywhere else.

I know this is invalid and so do most webservers/environments because
everywhere else I have ever coded I see the "headers already sent, output
started at" message.  I have used Windows, Linux, and FreeBSD versions of
PHP with Apache 1.3 and 2 and had the error print out as expected.

I want to know if any of you know the reason why this is happening.  I would
prefer the strict error messages to help keep everyones coding in check.
Unfortunately I cannot for the life of me seem to find any configuration
settings which point to this.  Any pointers or help would be greatly
appreciated.

Thank you in advance!

--- End Message ---
--- Begin Message ---
On Fri, Feb 10, 2006 at 05:44:26PM -0500, Eric Butera wrote:
> PHP List,
> 
> Perhaps one of you might know the answer to this, because I certainly do
> not, nor do any of my coworkers.  The "problem" is that scripts on our OSX
> 10.4 (our local development machines) and RedHat/Debian linux servers do not
> throw the "headers already sent" message.  I could have an entire page of
> html, php code, whatever I wish and call session_start() at the bottom of
> the page and everything would be fine.  No errors on screen, in error_log,
> or anywhere else.
> ...
> 
> I want to know if any of you know the reason why this is happening.  I would
> prefer the strict error messages to help keep everyones coding in check.
> Unfortunately I cannot for the life of me seem to find any configuration
> settings which point to this.  Any pointers or help would be greatly
> appreciated.

To check were the php.ini file is suppose to be, create a page
called like phpinfo.php and put the line:
  <?php phpinfo();

That will have a section showing where the Configuration file php
is looking for. if it just specifies a directory, then it mean
there is no php.ini file in that directory an php is just using all
the default values.

The things that would cause the error message not to show up would
be things like:
  'php.ini:display_errors' if set to Off, it wont show any errors

  'php.ini:output_buffering' if is set to something other than Off
  then there is a chance that php got lucky and didn't send any
  data yet by the time it got to the session_start() call.

Curt.
-- 
cat .signature: No such file or directory

--- End Message ---
--- Begin Message ---
Eric Butera wrote:

PHP List,

Perhaps one of you might know the answer to this, because I certainly do
not, nor do any of my coworkers.  The "problem" is that scripts on our OSX
10.4 (our local development machines) and RedHat/Debian linux servers do not
throw the "headers already sent" message.  I could have an entire page of
html, php code, whatever I wish and call session_start() at the bottom of
the page and everything would be fine.  No errors on screen, in error_log,
or anywhere else.

I know this is invalid and so do most webservers/environments because
everywhere else I have ever coded I see the "headers already sent, output
started at" message.  I have used Windows, Linux, and FreeBSD versions of
PHP with Apache 1.3 and 2 and had the error print out as expected.

I want to know if any of you know the reason why this is happening.  I would
prefer the strict error messages to help keep everyones coding in check.
Unfortunately I cannot for the life of me seem to find any configuration
settings which point to this.  Any pointers or help would be greatly
appreciated.

Thank you in advance!

Mostly out of curiosity, but also somewhat out of my
troll-like and pedantic nature, what happens if you
start your scripts with:

<?php

           error_reporting(E_STRICT);


??

And, the obvious troll question:  you do have session
support compiled?

Kevin Kinsey

--
Anyone who has had a bull by the tail
knows five or six more things than someone who hasn't.
                -- Mark Twain

--- End Message ---
--- Begin Message ---
pedro mpa wrote:

Greetings!

I am building a website using PHP 5.1.2 and MySQL 5.0.18 and I am using
windows xp with IIS.
All the hosting companies I have contacted are using php 4.x.x and mysql
4.x.x or 3.x.x, on linux I suppose.

Are php versions the same for every os/platform?

Thanks in advance.



PHP 5.1.2 is the 'latest and greatest', or pretty close to it.

For various reasons, hosting companies tend to be reluctant
to upgrade such things; the old (USA, anyway) engineer's
adage "if it ain't broke, don't fix it" comes to mind --- and
these hosting companies figure that it's working and they
don't want to take chances, IMHO.

An even greater reason behind this fact/trend that you notice
is that PHP has become so well-known that websites of all
types are using it, even those whose "webmasters" don't know
much about how to write in/use the language; therefore they
are using "c'n'p ed" scripts from the net that may date back
some distance in Net-Time; register_globals must be on,
"long" global arrays (although they're pretty much backwards-
compatible with PHP 5.X), etc., and deprecated $foo ad nauseum.
The hosting companies don't want their helpdesks flooded with
calls of "OMG my site is down!", and "Why doesn't my shopping cart |
contact form | uploader | downloader | gallery | ... work???"

During my last local update of PHP I finally updated php.ini
as well; took me quite a while to get my business interface
running probably again because I'd written the first scripts
with "short tags" years ago.  That's the sort of thing they don't
want to have to deal with just yet.  Of course, the day will come
anyway, so they'd better be getting ready....

Richard Lynch wrote:

] I'm betting that you can get PHP 5.x out of http://pair.com, since
] they host http://php.net and you gotta figure they're on top of things
] like that, eh?

Pair.com would probably be an excellent choice.  Not only do they
host php.net, but they are very supportive of the Open-Source
movement as a whole, <flamebait>and run the best OS on the planet </fb>.

] YMMV
] NAIAA
] IANAL

Neither am I.  TIFWIW ....

Kevin Kinsey

--
Although the moon is smaller than the earth, it is farther away.

--- End Message ---
--- Begin Message ---
Hi, folks.

A few of you provided me with some great feedback. I've encorporated
most of the suggestions into the examples. There is a bug fix in
there, too (get_tag_contents()), so be sure to check it out. =)

http://www.joot.com/dave/writings/articles/php-examples.shtml

Now that we all know how to auto-complete city and country, let's use
it. ;-) If anyone can find a royalty-free way to automatically
complete region (provice/state), that'd be great. E-mail me directly,
as I've removed myself from the mailing list (too much traffic).

Thanks for all the help!

Dave

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

I have to rewrite an application from ASP. In this application, I
receive DBase files which may be saved into Oracle.
In ASP, I used a generic driver and I made SQL requests on these files.
It is possible with PHP on Linux ?
Do you have some examples ?

Thank you very much.

David.

Attachment: signature.asc
Description: Ceci est une partie de message numériquement signée


--- End Message ---
--- Begin Message ---
At 07:27 PM 2/10/2006, David BERCOT wrote:

Hi,

I have to rewrite an application from ASP. In this application, I
receive DBase files which may be saved into Oracle.
In ASP, I used a generic driver and I made SQL requests on these files.
It is possible with PHP on Linux ?
Do you have some examples ?

Thank you very much.

David.

Come on -- read the manual. There's a section .dbf files.

Miles

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 267.15.4/255 - Release Date: 2/9/2006

--- End Message ---
--- Begin Message ---
Jochem Maas wrote:

Duggles Temple wrote:


I am having a problem with a shop system. I can't add values into the MySQL DB via a PHP statement. The values are being transferred from one page to
another (know that from the echo statement), but the SQL statement isn't
working.

The statement is as follows:

$conn = mysql_connect($DBhost,$DBuser,$DBpass) or die('Unable to connect to
database');
$t = $_GET['newdvdtitle'];
$y = $_GET['newdvdyear'];
$c = $_GET['newdvdcost'];
$p = $_GET['newdvdpurchased'];
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$sqladd = "INSERT INTO 'dvd' ('id', 'title', 'year','cost','purchased')
VALUES (  NULL , '$t', '$y', '$c' , '$p' )";
echo $sqladd;


using echo to find out whats' in your variable is a good start, also
take a look a print_r() and var_dump() - they given more feedback regarding
passed in vars.

it would have been useful if you had actually posted the output of the
echo statement.

$result = mysql_query($sqladd);


try adding something like:

if (!$result) {
    die(mysql_errno($conn) . ": " . mysql_error($conn) . "\n")
}


Very good habit to be into.  Also, adding the query will help during
the "debugging phase" of development.  I generally use something like:

mysql_query("$query") or die("Error in query: query was $query and MySql sez: ".mysql_error());

If, as the continuing thread suggests, the query is actually empty,
the above would make that rather obvious right away.

HTH,

Kevin Kinsey

--
Adler's Distinction:
        Language is all that separates us from the lower animals,
        and from the bureaucrats.

--- End Message ---
--- Begin Message ---
hello

i have been trying to learn php.

what is the best approach to learning php for someone who has no programming experience?

i am very familiar with html, xhtml, and css. i'm not an idiot when it comes to using computers. i have bought several books and have subscribed to a couple of the php mailing lists, but i feel that i could be doing more to learn php.

what approach (and steps) did you take in learning this really cool scripting language? should i look into taking classes or stick with an autodidact approach?

any advice and/or opinions would be greatly appreciated.

thanks.

--- End Message ---
--- Begin Message ---
i have been trying to learn php.

what is the best approach to learning php for someone who has no programming experience?

i am very familiar with html, xhtml, and css. i'm not an idiot when it comes to using computers. i have bought several books and have subscribed to a couple of the php mailing lists, but i feel that i could be doing more to learn php.

what approach (and steps) did you take in learning this really cool scripting language? should i look into taking classes or stick with an autodidact approach?

well, this is free...

http://www.hudzilla.org/phpbook/

--- End Message ---
--- Begin Message ---
On 2/10/06, /dev/null <[EMAIL PROTECTED]> wrote:
>
> hello
>
> i have been trying to learn php.
>
> what is the best approach to learning php for someone who has no
> programming experience?
>
> i am very familiar with html, xhtml, and css. i'm not an idiot when it
> comes to using computers.
> i have bought several books and have subscribed to a couple of the php
> mailing lists, but i feel that i could be doing more to learn php.
>
> what approach (and steps) did you take in learning this really cool
> scripting language? should i look into taking classes or stick with an
> autodidact approach?
>
> any advice and/or opinions would be greatly appreciated.
>
> thanks.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> I think I won't be the only one that says the best way to learn is by some
experience.  A simple but effective way is to choose something that
interests you, create a small database and then a PHP interface to fill it
up and display information out.  If you can't think of an interest, ask your
friends and family for something they want to keep records of.

Load the free (as in beer) software you need on your computer (LAMP or
WAMP?) and start making examples.  If you can't seem to get motivated on
your own, involving someone else who really wants to see results is probably
the best motivation.

Keep in mind the goal of learning PHP and not making the best display, user
interface, database tables, security (at first), etc.  Getting some results
will probably help motivate you further.   Don't wait to finish the books
before you start. You won't remember it all anyway, so just skim the books
and use as references.

good luck,
--
http://kimbriggs.com

--- End Message ---
--- Begin Message ---
On 11/02/2006 10:10 AM, /dev/null wrote:
hello

i have been trying to learn php.

what is the best approach to learning php for someone who has no programming experience?

i am very familiar with html, xhtml, and css. i'm not an idiot when it comes to using computers. i have bought several books and have subscribed to a couple of the php mailing lists, but i feel that i could be doing more to learn php.

what approach (and steps) did you take in learning this really cool scripting language? should i look into taking classes or stick with an autodidact approach?

any advice and/or opinions would be greatly appreciated.

thanks.


I honestly believe the best way to learn any programming language, aside from perhaps tertiary study (and then only perhaps), is to start out with a project and ask the questions you need to solve as you build that project.

It should quickly become obvious which things you need to learn, as you plan and pursue the project.

Some of those questions might be:

- I need to access data in a database. How do I do that?
- I need to be able to carry data from one page to another, how do I do that? - I need to be able to store 'stuff' at one point in a page (ie, maybe data I got from the database) so I can use it again at another point in the page.

And so on.

Armed with those questions, you can go through your books, go through helpful web sites (don't underestimate the quality of the docs and comments on php.net) and ask questions in forums like this one.

Another useful way of picking up knowledge that might not be relevant to you right now, but will probably be handy to know later, is reading threads in this mailing list. That way you learn about the kinds of problems others have encountered, and the suggestions for solving them they have received.

Much warmth,

Murray
---
"Lost in thought"
http://www.planetthoughtful.org

"Urban legends, superstitions, ghost
stories and folklore"
http://www.ulblog.org

--- End Message ---
--- Begin Message ---
If you like to learn while playing, you may want to look
at http://www.webertrivia.com. You can learn PHP, MySQL
And Linux while playing trivia :)

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP & MySQL Forums : http://www.weberforums.com
Search for PHP Code from your browser http://toolbar.weberdev.com 
 

-----Original Message-----
From: /dev/null [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 11, 2006 2:10 AM
To: php-general@lists.php.net
Subject: [PHP] how to learn php

hello

i have been trying to learn php.

what is the best approach to learning php for someone who has no programming
experience?

i am very familiar with html, xhtml, and css. i'm not an idiot when it comes
to using computers.
i have bought several books and have subscribed to a couple of the php
mailing lists, but i feel that i could be doing more to learn php.

what approach (and steps) did you take in learning this really cool
scripting language? should i look into taking classes or stick with an
autodidact approach?

any advice and/or opinions would be greatly appreciated.

thanks.

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

--- End Message ---
--- Begin Message ---
I started out by getting a reference manual, one with every function
describing what the function does. Just like the php.net online function
reference but one that can be read lying on the couch.

Now when I need some code to do something I'll remember there's a function
for it (maybe) and I go to php.net and search for it.

I search for PHP examples online for more advanced stuff than I can do and
study it. This gives me some knowledge of proper approach to coding; when to
use what.

Finally if the code looks funky I send a snip to this list and someone will
suggest a better function or approach.

Oh yea, this is great, I use Dreamweaver's (grimace) PHP coding abilities to
get projects started. Dreamweaver can do the preliminary basic database
connection stuff: INSERT, UPDATE, DELETE pages. Then I hack the Dreamweaver
code.

Doing a MySQL tutorial is a good idea too.

> hello
> 
> i have been trying to learn php.
> 
> what is the best approach to learning php for someone who has no
> programming experience?
> 
> i am very familiar with html, xhtml, and css. i'm not an idiot when it
> comes to using computers.
> i have bought several books and have subscribed to a couple of the php
> mailing lists, but i feel that i could be doing more to learn php.
> 
> what approach (and steps) did you take in learning this really cool
> scripting language? should i look into taking classes or stick with an
> autodidact approach?
> 
> any advice and/or opinions would be greatly appreciated.
> 
> thanks.

--- End Message ---
--- Begin Message ---

http://www.businessweek.com/technology/content/feb2006/tc20060209_810527.htm

"Also in Oracle's crosshairs: closely held Zend, based in Cupertino, Calif. Zend's PHP software language is one of the most prevalent on the Web, present in more than 18 million Web sites. The company, which snared headlines last year when Netscape co-founder Marc Andreessen joined its board, has been trying to extend its success with the Web into business applications. Zend could sell for $200 million, according to one source."


----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: [EMAIL PROTECTED]           Yahoo!: yscrappy              ICQ: 7615664

--- End Message ---
--- Begin Message ---
HoWang Wang wrote:
> Hi all,
> 
> The Zend Encoder 4.0 (beta) have a new function in the license manager
> which can limit the number of concurrent users. I have wriiten something
> to work like it. But I found a problem. My script can limit the number
> of concurrent running script only. When the script ends, there is some
> data remain in the buffer (of Apache, I think) and the client connection
> is still active! How can I solve this? Please help, Thanks.
> 
> Regards

Is it really impossible? Can I do it with Connection Handling?
<?php
    set_time_limit(0);
    ignore_user_abort(true);
    // add 1 to the number of concurrent users
    // the rest of code
    while (!connection_aborted()) {
        // keep on locking
    } else {
        // release lock
    }
?>

--- End Message ---

Reply via email to