OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: php-general-digest-helplists.php.net
Date: Thu Oct 25 2001 - 04:41:21 CDT

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    php-general Digest 25 Oct 2001 09:41:21 -0000 Issue 955

    Topics (messages 72172 through 72232):

    Re: I NEED HELP WITH PWS AND W98
            72172 by: Gaylen Fraley

    Re: Trying to subtract...no luck. (Long Code)
            72173 by: Chris Hayes
            72175 by: Michael O'Neal

    Re: PHP object communication
            72174 by: Martín Marqués
            72178 by: ad.m.beecher.net
            72180 by: Martín Marqués
            72182 by: Martín Marqués

    authentication help
            72176 by: Norman Zhang

    Q:Why is my code returning this? Help?
            72177 by: Marcus James Christian
            72179 by: Martín Marqués
            72227 by: gaouzief

    socket question
            72181 by: Tim Ballantine
            72185 by: James Cave
            72226 by: Tim Ballantine
            72229 by: Tim Ballantine

    I've never seen anything like this!! 24556
            72183 by: singh2578.yahoo.com

    Re: URL variables
            72184 by: Martin Towell
            72231 by: Tim Ward

    Re: MSSQL 7.0 and PHP
            72186 by: James Cave

    PDF library
            72187 by: pierre.marcandella.free.fr
            72188 by: Jason Murray
            72190 by: pierre.marcandella.free.fr
            72193 by: pierre.marcandella.free.fr
            72197 by: Pierre
            72200 by: Michael A. Peters

    Re: Using Logical OR operator in IF statement???
            72189 by: Mark
            72191 by: Martin Towell

    PHP library
            72192 by: pierre.marcandella.free.fr

    Re: Php and Emacs21
            72194 by: Mark

    conjob etc.
            72195 by: Arnold Gamboa

    Re: Enabling php in only certain hosts and directories
            72196 by: Joseph Blythe

    About mail attachments
            72198 by: Nigam Chheda
            72199 by: Jason Murray

    Netscape 6.1 problem and SELECT lists / FORMS
            72201 by: Jason Caldwell
            72202 by: Martin Towell

    Sending / Receiving Cookies with Fopen??
            72203 by: Andrew Reberry

    Re: libxml
            72204 by: php

    disable_functions not working in httpd.conf
            72205 by: Joseph Blythe
            72232 by: Arpad Tamas

    Regex problem
            72206 by: Leon Mergen
            72208 by: liljim
            72210 by: Kodrik
            72219 by: Calin Uioreanu

    = 0 and = "0"
            72207 by: Robin Chen
            72209 by: Vitali Falileev
            72211 by: Matthew Loff
            72212 by: Kodrik
            72215 by: Rasmus Lerdorf
            72216 by: Kodrik
            72220 by: Robin Chen
            72221 by: Robin Chen
            72222 by: Rasmus Lerdorf
            72224 by: Kodrik
            72225 by: Rasmus Lerdorf
            72228 by: Rasmus Lerdorf
            72230 by: Kodrik

    Re: talking directly w/ MySql
            72213 by: Christian Reiniger
            72217 by: Kodrik

    Re: Object sharing
            72214 by: Christian Reiniger

    Re: is_int() and is_double
            72218 by: Christian Reiniger

    Re: Removing an Array Element
            72223 by: Christian Reiniger

    Administrivia:

    To subscribe to the digest, e-mail:
            php-general-digest-subscribelists.php.net

    To unsubscribe from the digest, e-mail:
            php-general-digest-unsubscribelists.php.net

    To post to the list, e-mail:
            php-generallists.php.net

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

    attached mail follows:


    I've been running Apache on 98SE (I agree - DON'T ASK!) for most of this
    year without ny issues at all. Win98needs reboots a few times a week, but
    it's not Apache's problem. I also run PHP4.0.6 and 4.0.8-dev and MySQL
    3.23.43 and they all work and play well together. Just to keep my sanity, I
    also run a linux server too :). It helps me knowing that computers aren't
    supposed to have to be rebooted to keep them stable!

    --
    Gaylen
    gfraley5earthlink.net
    http://www.gaylenandmargie.com
    PHP KISGB v2.1 Guestbook http://www.gaylenandmargie.com/phpwebsite
    

    "Richard S. Crawford" <rscrawfordmossroot.com> wrote in message news:5.1.0.14.0.20011024085916.02d30c90pop3.norton.antivirus... Getting PHP to work with Apache is pretty simple. The documentation is easy to read.

    I would agree with trying Apache on your Win98 box; but be warned that the current Apache release is only supposed to be stable on NT platforms. Since I have win2k it's not an issue for me, but it might now work on Windows 98.

    At 08:54 AM 10/24/2001, Chris Hayes wrote: >hi Nicolas, >pws is not so great. if you are still in the beginning phase >you may consider to use the free Apache server. It has a >version for windows, very stable. >You just need to make some changes to the configuration file to >make php work. btw you do not need to compile php if you >download the right version! (don't download 'source' but maybe >they call it 'binary' or whatever). > >There are even packets on the internet which include working >combinations of apache + php4 + mysql (mysql= free very popular >web database). Just do a search on a search engine. >There are also instruction pages on how to make php work on >apache (you need to change two or three lines in a >configuration file). > >good luck. >Chris

    Sliante, Richard S. Crawford

    http://www.mossroot.com mailto:rscrawfordmossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford "It is only with the heart that we see rightly; what is essential is invisible to the eye." --Antoine de Saint Exupéry

    "Push the button, Max!"

    attached mail follows:


    Jeez michael, i'm sorry but i am not going to go through all of your code.

    I do have a suggestion for you, without looking at the code.

    As you know. php has flexible variables. I mean, if you say $a=1 then $a is an integer, if you say $b='i' then $b is a string. Very easy to make code quickly, but for the larger scripts it can be a pit trap.

    I think that while you intended the variables to be numbers, they somehow turned into strings. Maybe you added a (empty) string somewhere ($a .='').

    Several ways to deal with it. First have a look at what is in the variable:

    echo '<hr>string "a" is ['.$a.']'; i always add something around the string to see spaces.

    Another thing you can try is to force the value into an integer. I think something like

    $c= intval($a) - intval ($b);

    but have a look around the manual to be sure.

    hth, let me know at my own email if it helped?

    Chris

    --------------------------------------------------- ----------------- -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- --------------------------------------------------- -----------------

    attached mail follows:


    Thanks all...I got what I needed. I'm amazed at how many different ways there are to do the same thing!

    mto

    -- 
    

    Michael O'Neal Web Producer/ Autocrosser ST 28 '89 Civic Si --------------------- M A N G O B O U L D E R --------------------- http://www.thinkmango.com e- mikethinkmango.com p- 303.442.1821 f- 303.938.8507

    attached mail follows:


    On Mié 24 Oct 2001 18:45, you wrote: [snip] > > Tying the first two together is no problem, I can just extend the Config > class. However I would like to incorporate the third and fourth as objects > inside the main object: > > <? > > // In fact these would be instantiated (is that the > // right word?) inside the Core class. > > $Core = new Core; > $Core->Error = new Error; > $Core->DB = new DB > > ?> > > This is fine when working in the main application, or in the $Core object, > but where I get stuck is with communication between the $Core->Error and > $Core->DB objects. Say for example that within the DB class I encountered > an error, and wanted to talk to the Error object - I /could/ do this: > > <? > > class DB { > > var $Error; > > function DB() { > global $Core; > $this->Error = $Core->Error; > } > > } > > ?> > > But if I extend the application later and add a bunch of new classes, it > means I have to do the same for each object I add. I get the impression > that I might be able to do this with references, but I can't get a handle > on them for the life of me. Can someone explain?

    I think you have things mistaken. What you want is to EXTEND an existing object with new variables and functions. See class CLASS_NAME EXTENDS OLD_CLASS.

    This is inheritence, a very good thing that OOP has. It means that the new clase will have all the properties that OLD_CLASS had, plus the new ones you add to it.

    > Sorry for the lengthy post.

    No problem, that's what snip is for. ;-)

    -- 
    Porqué usar una base de datos relacional cualquiera,
    si podés usar PostgreSQL?
    -----------------------------------------------------------------
    Martín Marqués                  |        mmarquesunl.edu.ar
    Programador, Administrador, DBA |       Centro de Telematica
                           Universidad Nacional
                                del Litoral
    -----------------------------------------------------------------
    

    attached mail follows:


    > I think you have things mistaken. What you want is to EXTEND an existing > object with new variables and functions. See class CLASS_NAME EXTENDS > OLD_CLASS. > Quick answer appreciated Martín, but I really don't. I'd like to keep, for example, the $Core->Error and $Core->DB objects separate from each other, while still allowing them to talk to each other. I've been playing with this for ages, and I'm starting to feel that I've seriously overcomplicated it for myself. I mean, it's just inter-object communication, isn't it? :)

    adam

    attached mail follows:


    On Mié 24 Oct 2001 19:45, adm.beecher.net wrote: > > I think you have things mistaken. What you want is to EXTEND an existing > > object with new variables and functions. See class CLASS_NAME EXTENDS > > OLD_CLASS. > > Quick answer appreciated Martín, but I really don't. I'd like to keep, for > example, the $Core->Error and $Core->DB objects separate from each other, > while still allowing them to talk to each other. I've been playing with > this for ages, and I'm starting to feel that I've seriously overcomplicated > it for myself. I mean, it's just inter-object communication, isn't it? :)

    <checking OOP books> I think that's not how Objects work in a real OOP aplication, and I think yu should think about using EXTENDS. </checking OOP books>

    You can create new classes that extend the same OLD_CLASS, so I can't imaging why you don't want to extend it?

    P.D.: Maybe you need something even more powerfull, that PHP doesn't have at this moment. Multiple extends (create a new class that extends more then one class).

    Saludos... :-)

    -- 
    Porqué usar una base de datos relacional cualquiera,
    si podés usar PostgreSQL?
    -----------------------------------------------------------------
    Martín Marqués                  |        mmarquesunl.edu.ar
    Programador, Administrador, DBA |       Centro de Telematica
                           Universidad Nacional
                                del Litoral
    -----------------------------------------------------------------
    

    attached mail follows:


    On Mié 24 Oct 2001 19:45, adm.beecher.net wrote: > > I think you have things mistaken. What you want is to EXTEND an existing > > object with new variables and functions. See class CLASS_NAME EXTENDS > > OLD_CLASS. > > Quick answer appreciated Martín, but I really don't. I'd like to keep, for > example, the $Core->Error and $Core->DB objects separate from each other,

    Sorry for the TOO FAST RESPONCE! :-) $Core is one object, and Error and DB are properties of the object.

    Let me put it clearer. You have an Error object, and you now want to make a DB object, with the same properties of the Error object. Just extend it.

    Personally I have never made an object that ha other objects definied inside it, but who knows....

    Saludos... :-)

    -- 
    Porqué usar una base de datos relacional cualquiera,
    si podés usar PostgreSQL?
    -----------------------------------------------------------------
    Martín Marqués                  |        mmarquesunl.edu.ar
    Programador, Administrador, DBA |       Centro de Telematica
                           Universidad Nacional
                                del Litoral
    -----------------------------------------------------------------
    

    attached mail follows:


    Hi,

    Would someone please give me a few pointers on how to generate a simple PHP to check for user's name and password before directing to a directory?

    e.g., I have a index.php with a form where I have action="login.php". How would I write login.php to check username and password if I have them hard coded in login.php and if authentication fails the user is directed back to index.php? Is this safe?

    Regards, Norman

    attached mail follows:


    Hello,

    As mainly a designer w/ HTML and JS php is usually just an end of site add on to process forms and I LOVE php!

    I've been away from PHP coding for about a month and I can't figure out what I'm forgetting here is partial of the form, the php handler, and the final email I get. If you see some syntax I'm botching let me know please.

    <form action="../php/dc_rif_handler.php" method="post"> <select name="title"> <option selected>Title...</option> <option>Mr.</option> <option>Ms.</option> <option>Mrs.</option> </select> </td></tr>

    <tr><td align="right"><font color="330000"><b>*First Name:</td> <td><input type="text" name="fname" size="48"></td></tr> <tr><td align="right"><font color="330000"><b>*Last Name:</td> <td><input type="text" name="lname" size="48"></td></tr> <tr><td align="right"><font color="330000"><b>*Mailing Address:</td> <td><input type="text" name="m_address" size="48"></td></tr>

    <tr><td align="right"><font color="330000"><b>*City, State, Zip:</td> <td><input type="text" name="city_state_zip" size="48"></td></tr> ......

    THE PHP HANDLER...

    Your form has been proccessed and sent to ... <?php

    $to = "dalecommonsformmjchristianunlimited.com" ; $subject = "A Dale Commons web site visitor is requesting information!";

    $message_raw = "My name is $fname, $lname \r$r1a, $r2a, $r3a\r$r1b\rhere is my contact information:\r$title, $fname, $lname, \r$m_address,\r$city_state_zip,\rPhone Number: $phone\rFax: $fax\rThe best time to call is $time_to_call\rMy email address is $e_address";

    $message_stripped = stripslashes($message_raw);

    mail ($to, $subject, $message_stripped, "From: <dalecommons_formsmjchristianunlimited.com>" ); ?>

    AND FINALLY THE SENSELESS EMAIL I GET AT THE END...

    My name is ,

    , , I am looking for a loved one. here is my contact information: , , , , , Phone Number: Fax: The best time to call is My email address is

    ......

    What in the world? Did I forget everything PHP taught me? What the heck are those weird commas from and I could swear a form element named "xname" is called in php via $xname ???

    Please let me know what you see, -Marcus

    PS, I just ran phpinfo(); on my server and it looks like all the others that work.

    --
    Marcus James Christian UNLIMITED
    Multimedia Internet Design
    http://mjchristianunlimited.com
    

    Proudly presents the music of CHROMATICUS at http://www.mp3.com/chromaticus and http://chromaticus.com

    attached mail follows:


    On Mié 24 Oct 2001 19:41, you wrote: [snip] > > THE PHP HANDLER... > > Your form has been proccessed and sent to ... > <?php > > $to = "dalecommonsformmjchristianunlimited.com" ; > $subject = "A Dale Commons web site visitor is requesting information!"; > > $message_raw = "My name is $fname, $lname > \r$r1a, $r2a, $r3a\r$r1b\rhere is my contact information:\r$title, > $fname, $lname, \r$m_address,\r$city_state_zip,\rPhone Number: > $phone\rFax: $fax\rThe best time to call is $time_to_call\rMy email > address is $e_address"; > > $message_stripped = stripslashes($message_raw); > > mail ($to, $subject, $message_stripped, "From: > <dalecommons_formsmjchristianunlimited.com>" ); > ?> > > AND FINALLY THE SENSELESS EMAIL I GET AT THE END... > > My name is , > > , , > I am looking for a loved one. > here is my contact information: > , , , > , > , > Phone Number: > Fax: > The best time to call is > My email address is > > ......

    Looks like the variables are not passed correctly or are not being coded to PHP variables (I know there is a PHP option to do this, but can't remember it). Check: magic_quotes_gpc, register_argc_argv and register_globals (I have them all ON).

    > What in the world? Did I forget everything PHP taught me? What the heck > are those weird commas from and I could swear a form element named > "xname" is called in php via $xname ???

    The comas are what you have in the $message_raw variable, but the variables you are passing it ($fname for example) are empty

    Use var_dump($fname) to see if the variable is set and to which value.

    Saludos... ;-)

    -- 
    Porqué usar una base de datos relacional cualquiera,
    si podés usar PostgreSQL?
    -----------------------------------------------------------------
    Martín Marqués                  |        mmarquesunl.edu.ar
    Programador, Administrador, DBA |       Centro de Telematica
                           Universidad Nacional
                                del Litoral
    -----------------------------------------------------------------
    

    attached mail follows:


    why are you using stripslaches?

    25/10/2001 00:41:45, Marcus James Christian <marcusmjchristianunlimited.com> wrote:

    >Hello, > >As mainly a designer w/ HTML and JS php is usually just an end of site >add on to process forms and I LOVE php! > >I've been away from PHP coding for about a month and I can't figure out >what I'm forgetting here is partial of the form, the php handler, and >the final email I get. If you see some syntax I'm botching let me know >please. > ><form action="../php/dc_rif_handler.php" method="post"> ><select name="title"> ><option selected>Title...</option> ><option>Mr.</option> ><option>Ms.</option> ><option>Mrs.</option> ></select> ></td></tr> > ><tr><td align="right"><font color="330000"><b>*First Name:</td> ><td><input type="text" name="fname" size="48"></td></tr> ><tr><td align="right"><font color="330000"><b>*Last Name:</td> ><td><input type="text" name="lname" size="48"></td></tr> ><tr><td align="right"><font color="330000"><b>*Mailing Address:</td> ><td><input type="text" name="m_address" size="48"></td></tr> > ><tr><td align="right"><font color="330000"><b>*City, State, Zip:</td> ><td><input type="text" name="city_state_zip" size="48"></td></tr> >...... > >THE PHP HANDLER... > >Your form has been proccessed and sent to ... ><?php > >$to = "dalecommonsformmjchristianunlimited.com" ; >$subject = "A Dale Commons web site visitor is requesting information!"; > >$message_raw = "My name is $fname, $lname >\r$r1a, $r2a, $r3a\r$r1b\rhere is my contact information:\r$title, >$fname, $lname, \r$m_address,\r$city_state_zip,\rPhone Number: >$phone\rFax: $fax\rThe best time to call is $time_to_call\rMy email >address is $e_address"; > >$message_stripped = stripslashes($message_raw); > >mail ($to, $subject, $message_stripped, "From: ><dalecommons_formsmjchristianunlimited.com>" ); >?> > >AND FINALLY THE SENSELESS EMAIL I GET AT THE END... > >My name is , > >, , >I am looking for a loved one. >here is my contact information: >, , , >, >, >Phone Number: >Fax: >The best time to call is >My email address is > >...... > > >What in the world? Did I forget everything PHP taught me? What the heck >are those weird commas from and I could swear a form element named >"xname" is called in php via $xname ??? > >Please let me know what you see, >-Marcus > >PS, I just ran phpinfo(); on my server and it looks like all the others >that work. > > >-- >Marcus James Christian UNLIMITED >Multimedia Internet Design >http://mjchristianunlimited.com > >Proudly presents the music of CHROMATICUS >at http://www.mp3.com/chromaticus >and http://chromaticus.com > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribelists.php.net >For additional commands, e-mail: php-general-helplists.php.net >To contact the list administrators, e-mail: php-list-adminlists.php.net > > >

    attached mail follows:


    Hey.

    Anoyone know how i would go about using one of the internal variables, such as phpinfo() or phpcredits() to send through a socket.

    like for: write ($msgsock, ":RWorld PRIVMSG $pnum :phpcredits()\n", strlen (":RWorld PRIVMSG $pnum :phpcredits()\n"));

    so it sends the actual information instead of just "phpcredits()". I have tried with $credits = phpcredits(); and placed the $credits in the line above, but that seemed to echo it to my console then send the number 1 through the socket.

    Any help on this would be greatly appreciated :)

    Tim

    attached mail follows:


    There is some source code on the php.net site which captures the credits with output buffering and then uses then in the page. Once you have the data in a variable you can do what you like to it.

    if (function_exists('ob_start')) { ob_start(); phpcredits(); $credits = ob_get_contents(); ob_end_clean(); }

    Maybe that will do the trick.

    attached mail follows:


    That seems to just give me the first line, of: <html><head><title>PHP Credits</title></head><body> but nothing else after that. Any ideas? :)

    Tim "James Cave" <james.cavewebsi.com.au> wrote in message news:3BD75437.F396DCE5websi.com.au... > > There is some source code on the php.net site which captures the credits > with output buffering and then uses then in the page. Once you have the > data in a variable you can do what you like to it. > > if (function_exists('ob_start')) { > ob_start(); > phpcredits(); > $credits = ob_get_contents(); > ob_end_clean(); > } > > Maybe that will do the trick.

    attached mail follows:


    That is, using a socket, that it gives me the one line. echo'ing it gives the whole thing.

    Tim "Tim Ballantine" <pot.noodleblueyonder.co.uk> wrote in message news:20011025091104.26980.qmailpb1.pair.com... > That seems to just give me the first line, of: > <html><head><title>PHP Credits</title></head><body> > but nothing else after that. Any ideas? :) > > Tim > "James Cave" <james.cavewebsi.com.au> wrote in message > news:3BD75437.F396DCE5websi.com.au... > > > > There is some source code on the php.net site which captures the credits > > with output buffering and then uses then in the page. Once you have the > > data in a variable you can do what you like to it. > > > > if (function_exists('ob_start')) { > > ob_start(); > > phpcredits(); > > $credits = ob_get_contents(); > > ob_end_clean(); > > } > > > > Maybe that will do the trick. > >

    attached mail follows:


    The WEB'S YOUNGEST WOMEN!!!!

    411control.com/gc/webyoung/?adv_id=107277">http://www.youngwebsluts.com411control.com/gc/webyoung/?adv_id=107277

    TEEN SUPER MODELS.......LIVE and INTERACTIVE VIDEOS

    YOUNG BABES GETTING DOWN AND DIRTY

    411control.com/gc/webyoung/?adv_id=107277">http://www.youngwebsluts.com411control.com/gc/webyoung/?adv_id=107277

    Over 18 only

    To be removed from this list please click the link below and enter your email address 411control.com/remove.php">http://www.youngwebsluts.com411control.com/remove.php

    attached mail follows:


    try $QUERY_STRING

    -----Original Message----- From: Clint Tredway [mailto:clintfactorxsoftware.com] Sent: Thursday, October 25, 2001 5:13 AM To: PHP General Subject: [PHP] URL variables

    How do I reference URL variables..?

    -- 
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    They're just there ...

    If the link is <a href='yourpage.php?yourvar=fred'>

    Then in yourpage.php ...

    echo($yourvar);

    the only way you may go wrong with this is with scoping, $yourvar isn't available in a function inside yourpage.php.

    Tim Ward ---------- From: Clint Tredway [SMTP:clintfactorxsoftware.com] Sent: 24 October 2001 20:13 To: PHP General Subject: URL variables

    How do I reference URL variables..?

    attached mail follows:


    > varchar only accepts values up to 255 (so does char)

    I've found this too .. MS-SQL probably ceil()s the parameter in the table create statement to 255 without throwing an error.

    Have a quick look at the column you've created and you'll probably find it's a char(255).

    > To get larger than that you have to use 'text'

    Sounds right to me.

    Regards

    James

    attached mail follows:


    Hi everybody,

    Does anyone know a way to check if a server is able or not to support PHP script including PDF related function ?

    I guess I need to know if the server has API idoine or something like that.

    Thanks for your help.

    Pierre

    By the way, any good tutorial about creation of PDF file using PHP ? The purpose is to print dynamic table.

    attached mail follows:


    Check the output from phpInfo() ...

    -- 
    Jason Murray
    jasonmmelbourneit.com.au
    Web Developer, Melbourne IT
    "Work now, freak later!"
    

    > -----Original Message----- > From: pierre.marcandellafree.fr [mailto:pierre.marcandellafree.fr] > Sent: Thursday, October 25, 2001 11:08 AM > To: php-generallists.php.net; > UNEXPECTED_DATA_AFTER_ADDRESS.SYNTAX-ERROR > Subject: [PHP] PDF library > > > Hi everybody, > > Does anyone know a way to check if a server is able or > not to support PHP script including PDF related function ? > > I guess I need to know if the server has API idoine or > something like that. > > Thanks for your help. > > Pierre > > By the way, any good tutorial about creation of PDF file > using PHP ? The purpose is to print dynamic table. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: > php-list-adminlists.php.net >

    attached mail follows:


    Hi everybody,

    Does anyone know a way to check if a server is able or not to support PHP script including PDF related function ?

    I guess I need to know if the server has API idoine or something like that.

    Thanks for your help.

    Pierre

    By the way, any good tutorial about creation of PDF file using PHP ? The purpose is to print dynamic table.

    attached mail follows:


    Hi everybody,

    Does anyone know a way to check if a server is able or not to support PHP script including PDF related function ?

    I guess I need to know if the server has API idoine or something like that.

    Thanks for your help.

    Pierre

    By the way, any good tutorial about creation of PDF file using PHP ? The purpose is to print dynamic table.

    attached mail follows:


    Thanks, I had a look, very usefull indeed.

    But I am still not quite sure about what I am looking for !!!

    Which information should I find to be sure the server can handle pdf function ?

    Thanks.

    Pierre

    ----- Original Message ----- From: Jason Murray <Jason.Murraymelbourneit.com.au> To: <pierre.marcandellafree.fr>; <php-generallists.php.net> Sent: Thursday, October 25, 2001 9:08 AM Subject: RE: [PHP] PDF library

    > Check the output from phpInfo() ... > > > -- > Jason Murray > jasonmmelbourneit.com.au > Web Developer, Melbourne IT > "Work now, freak later!" > > > -----Original Message----- > > From: pierre.marcandellafree.fr [mailto:pierre.marcandellafree.fr] > > Sent: Thursday, October 25, 2001 11:08 AM > > To: php-generallists.php.net; > > UNEXPECTED_DATA_AFTER_ADDRESS.SYNTAX-ERROR > > Subject: [PHP] PDF library > > > > > > Hi everybody, > > > > Does anyone know a way to check if a server is able or > > not to support PHP script including PDF related function ? > > > > I guess I need to know if the server has API idoine or > > something like that. > > > > Thanks for your help. > > > > Pierre > > > > By the way, any good tutorial about creation of PDF file > > using PHP ? The purpose is to print dynamic table. > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > > For additional commands, e-mail: php-general-helplists.php.net > > To contact the list administrators, e-mail: > > php-list-adminlists.php.net > > > >

    attached mail follows:


    look at http://24.5.29.77:10080/phpinfo.html That's a phpinfo() from a machine that supports pdflib

    You will clearly see the PDF library support and information about what library etc.-

    It's right below the pgsql support on that page.

    On Thu, 25 Oct 2001 12:25:31 +0800 "Pierre" <pierre.marcandellafree.fr> wrote:

    > Thanks, I had a look, very usefull indeed. > > But I am still not quite sure about what I am looking for !!! > > Which information should I find to be sure the server can handle pdf > function ? > > Thanks. > > Pierre > > ----- Original Message ----- > From: Jason Murray <Jason.Murraymelbourneit.com.au> > To: <pierre.marcandellafree.fr>; <php-generallists.php.net> > Sent: Thursday, October 25, 2001 9:08 AM > Subject: RE: [PHP] PDF library > > > > Check the output from phpInfo() ... > > > > > > -- > > Jason Murray > > jasonmmelbourneit.com.au > > Web Developer, Melbourne IT > > "Work now, freak later!" > > > > > -----Original Message----- > > > From: pierre.marcandellafree.fr [mailto:pierre.marcandellafree.fr] > > > Sent: Thursday, October 25, 2001 11:08 AM > > > To: php-generallists.php.net; > > > UNEXPECTED_DATA_AFTER_ADDRESS.SYNTAX-ERROR > > > Subject: [PHP] PDF library > > > > > > > > > Hi everybody, > > > > > > Does anyone know a way to check if a server is able or > > > not to support PHP script including PDF related function ? > > > > > > I guess I need to know if the server has API idoine or > > > something like that. > > > > > > Thanks for your help. > > > > > > Pierre > > > > > > By the way, any good tutorial about creation of PDF file > > > using PHP ? The purpose is to print dynamic table. > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > > > For additional commands, e-mail: php-general-helplists.php.net > > > To contact the list administrators, e-mail: > > > php-list-adminlists.php.net > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    -- 
    -=-=-=-=-=-=-=-=-=-=-=-=-
    Michael A. Peters
    http://24.5.29.77:10080/
    

    attached mail follows:


    >> if (substr($sString,(strlen($sString)-1)!="-")) {

    I think you meant either substr($sString,strlen($sString)-2) or substr($sString,-1)

    >> print "You can't have a dash at the end of your string."; >> } >> >> and this works: >> if (substr($sString,0,1)!="-") { >> print "You can't have a dash at the beginning of your string."; >> } >> >> But, this doesn't work for any case: >> if ((substr($sString,(strlen($sString)-1)!="-")) or >> (substr($sString,0,1)!="-")) { >> print "you can't have a dash at the beginning or end of your >>string."; >> } >> >> What could be wrong? I've used a logical OR operator in the >>middle of an >IF >> statement like this before, but for some reason, this just isn't >>working. >> Anyone got any ideas? I suppose I can just evaluate this with two >different >> IF statements, but it seems like I shoud be able to do it in one >>and >reduce >> duplicate code. Thanks very much in advance. >> >> .....Brad >> >> >> > > >

    -- 
    Mark, maggeletmminternet.com on 10/24/2001
    

    attached mail follows:


    >> if ((substr($sString,(strlen($sString)-1)!="-")) or

    Looks to me that the bracketing is wrong... try: if ((substr($sString,(strlen($sString)-1))!="-") or

    -----Original Message----- From: Mark [mailto:maggeletmminternet.com] Sent: Thursday, October 25, 2001 11:12 AM To: php-generallists.php.net Subject: Re: [PHP] Re: Using Logical OR operator in IF statement???

    >> if (substr($sString,(strlen($sString)-1)!="-")) {

    I think you meant either substr($sString,strlen($sString)-2) or substr($sString,-1)

    >> print "You can't have a dash at the end of your string."; >> } >> >> and this works: >> if (substr($sString,0,1)!="-") { >> print "You can't have a dash at the beginning of your string."; >> } >> >> But, this doesn't work for any case: >> if ((substr($sString,(strlen($sString)-1)!="-")) or >> (substr($sString,0,1)!="-")) { >> print "you can't have a dash at the beginning or end of your >>string."; >> } >> >> What could be wrong? I've used a logical OR operator in the >>middle of an >IF >> statement like this before, but for some reason, this just isn't >>working. >> Anyone got any ideas? I suppose I can just evaluate this with two >different >> IF statements, but it seems like I shoud be able to do it in one >>and >reduce >> duplicate code. Thanks very much in advance. >> >> .....Brad >> >> >> > > >

    -- 
    Mark, maggeletmminternet.com on 10/24/2001
    

    -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-helplists.php.net To contact the list administrators, e-mail: php-list-adminlists.php.net

    attached mail follows:


    Hi everybody,

    Does anyone know a way to check if a server is able or not to support PHP script including PDF related function ?

    I guess I need to know if the server has API idoine or something like that.

    Thanks for your help.

    Pierre

    By the way, any good tutorial about creation of PDF file using PHP ? The purpose is to print dynamic table.

    attached mail follows:


    On Tue, 23 Oct 2001 21:59:10 -0700, Nick Richardson wrote: >Put this file in your emacs/lisp/progmodes dir... then make sure that >secureCRT has ANSI Color checked in your site's emulation >configuration... > >Then add (autoload 'php-mode "php-mode-099" "PHP Mode" t) to your >.emacs >file. > >This is how i do it on a windows box... it should work just the same >on a >unix system. - if it doesn't work, search for php-mode-099 on google >and >find the documentation on how to install it =)

    Thanks, this mode deals with highlighting php pretty well, but it doesn't seem to know how to deal with html blocks. I haven't found anything better yet though.

    I did find a good ssh client called putty that does emacs color really well and is freeware.

    attached mail follows:


    Hi there.

    Need your help / comments on this couple of issues.

    1. I already have a php compiled in apache module running.. How can i install a cgi version that will also support mysql/postgresql/interbase (as it was also supported on the compiled version)

    2. If I'll be running a cron job calling a php script that access mysql and reads data EVERY 5 MINS, will i exhaust my box's resources? That is the best /safest thing i have in mind in as far as doing an email account manipulation on the linux box. Any idea is also appreciated.

    Thanks.. Mabuhay!

    --
    Arnold Gamboa
    Pres., Managing Dir.
    SparrowInteractive.com, Inc.
    arnoldsparrowinteractive.com
    http://www.sparrowinteractive.com
    (63) 2 -  532-5373 / 532-5387
    

    ------------------------------- "He chose the nails"

    attached mail follows:


    Thanks! What would people reccommend?

    1) just using safe mode

    2) using open_basedir and disable_functions

    3) all of the above?

    4) Just shutoff the server :)

    If (2) or (3) what functions are most at risk? I understand that safe_mode limits quite a few already.

    Regards,

    Joseph

    -----Original Message----- From: Tamas Arpad [mailto:stsmail.xubion.hu] Sent: Wednesday, 24 October 2001 11:01 PM To: php-generallists.php.net Subject: Re: [PHP] Enabling php in only certain hosts and directories

    On Wednesday 24 October 2001 08:19, you wrote: > Well, php runs the same as apache, so whatever apache can access, > php can access. > So any files with the db passwords that need to be accessed by php, > can be seen by all users who can upload php scripts to your server. That's not completely true. You can use open_basedir, safe_mode settings in apache's configuration, based on virtualhosts or even directories. This way you can restrict users, virtual hosts to their own directories. Arpi

    > > Hello all, > > > > I am just configuring up a new web server, and I want to be able > > to run php only in the web servers main document root and in > > specified virtual hosts, I have a fair understanding on how to go > > about this, but would really like some feedback before I get to > > far into it. Basically the only directories I don't want to be > > able to use php are all the user directories (/~username) unless > > they have been mapped to a virtual host that has the right > > directives in them to enable php.

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    hi how to send an attachment in PHP mail can anyone pl send a sample code

    Nigam

    attached mail follows:


    > how to send an attachment in PHP mail > can anyone pl send a sample code

    http://planetkiller.shadow.net.au/mime-php.txt

    Jason

    -- 
    Jason Murray
    jasonmmelbourneit.com.au
    Web Developer, Melbourne IT
    "Work now, freak later!"
    

    attached mail follows:


    NS6.1 remembers the items that were selected in a SELECT list when I call the same page back with a header() function... normally this wouldn't be a problem -- however, in my case, I am (through PHP) printing all selected items to the top of the list, and all unselected items to the bottom -- this has the effect of showing all the users (right up front / top) all the selections they've made without having to scroll through the entire list --

    Now, in NS4.x and IE5.x this functionality works fine. But in NS6.1 the items are pushed to the top alright, however, they aren't highlighted (ie. selected) -- looking at the source for the page, the SELECTED statement is in the <option> tag (as I said, it works fine in everything but NS6.1 :-) )

    Through playing around, I discovered that with NS6.1 -- this is the result of the FORM NAME (ie. name="frmWhatever") -- I appended a random number at the end of the FORM NAME each time I pressed the submit button and the page was called back through a header() function. This seemed to fix the problem (ie. the items in the select list that were suppose to be selected, were!) -- however, all other items on my forms lost their data (again, only in NS6.1) -- so, if nothing else, I at least discovered that the FORM NAME plays a roll in this dysfunctionality.

    Now I ask you -- the great pool of knowledge -- any suggestions on how I can get NS6.1 forms to behave?

    Thanks. Jason

    attached mail follows:


    Haven't tried this, but what about sending "nocache" headers to the browser (??)

    -----Original Message----- From: Jason Caldwell [mailto:jasonthinkingman.org] Sent: Thursday, October 25, 2001 4:12 PM To: php-generallists.php.net Subject: [PHP] Netscape 6.1 problem and SELECT lists / FORMS

    NS6.1 remembers the items that were selected in a SELECT list when I call the same page back with a header() function... normally this wouldn't be a problem -- however, in my case, I am (through PHP) printing all selected items to the top of the list, and all unselected items to the bottom -- this has the effect of showing all the users (right up front / top) all the selections they've made without having to scroll through the entire list --

    Now, in NS4.x and IE5.x this functionality works fine. But in NS6.1 the items are pushed to the top alright, however, they aren't highlighted (ie. selected) -- looking at the source for the page, the SELECTED statement is in the <option> tag (as I said, it works fine in everything but NS6.1 :-) )

    Through playing around, I discovered that with NS6.1 -- this is the result of the FORM NAME (ie. name="frmWhatever") -- I appended a random number at the end of the FORM NAME each time I pressed the submit button and the page was called back through a header() function. This seemed to fix the problem (ie. the items in the select list that were suppose to be selected, were!) -- however, all other items on my forms lost their data (again, only in NS6.1) -- so, if nothing else, I at least discovered that the FORM NAME plays a roll in this dysfunctionality.

    Now I ask you -- the great pool of knowledge -- any suggestions on how I can get NS6.1 forms to behave?

    Thanks. Jason

    -- 
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    Hello all. I have a problem to solve, but have no idea where to start..

    I am writing a site right now that needs to read information from many other web pages on different domains (using fopen). However a few sites have given me the error: "you need to have cookies enabled to view this page". This is because it is the PHP engine that is hitting the web page, and not my browser directly. The PHP engine does not support cookies as my browser does, thus I get this 'no cookies' error.

    Is there any way to make these web sites think I have cookies enabled? Can I send specific message headders that would mimic having cookies present? Or can I encode the cookies into the URL in some way? Or better yet, is there a way to allow PHP to accept cookies and send these back to the server every time I request a page?

    Thanks for any help. I have no idea were to turn next!

    Andrew

    --
    FYII:  The fopen type stuff I'm doing is..
    

    $file = fopen ("$Hyperlink", "r"); while (!feof ($file)) { $line = fgets ($file, 1024); // yadda yadda yadda } fclose($file);

    attached mail follows:


    Hi,

    I need to use PHP from cvs for other reasons. Anyway, libxml 2.3.9 -> Configure wants a higher version (2.4.2). libxml 2.4.6 -> Causes the trouble. libxml 2.4.2 -> Wont build - dies after configre libxml 2.4.5 -> same problem

    BTW, this error appears for xmltree calls.

    am wokring on clearing out bad redhate 7.1 libraries which may be causing conflicts, before attempting again. Its my poorly educated guess, that this may be the cause.

    Sean

    -----Original Message----- From: Tamas Arpad [mailto:stsmail.xubion.hu] Sent: Wednesday, 24 October 2001 11:55 PM To: php; php-generallists.php.net Subject: Re: [PHP] libxml

    On Wednesday 24 October 2001 11:38, php wrote: > Firstly, > I use php 4.0.5 and libxml 2.3.9 on several machines without any problem.

    Older php and libxml combinations however caused many segmentation faults, especially with not well-formatted xmls.

    Are you sure that you warning message is related to libxml library? If you compile php without domxml the warning message disappears? Arpi

    > thanks to those who replied to me last week about xmldom support > with this error: > > Warning: Unknown list entry type in request shutdown (0) in > Unknown on line 0 > > I've since tried a few combinations of versions of libxml, and > expat (dont know if expat would > matter), any was wondering if anyone who is using dom support > correctly could > tell me which versions work for them. > > > Thank you, > > Sean

    -- 
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    Hey All,

    Was just trying the following and disable_functions is not working? Although safe mode and open_basedir are! What is really strange that when phpinfo is called the disable_functions value is phpinfo, can't seem to disable echo either, I don't want to put these in php.ini as I still want to be able to have a fully fledged php running from the main document root.

    <VirtualHost *> ServerAdmin foobar.com.au DocumentRoot /home/test/public_html ServerName test.foo.bar.com.au ErrorLog logs/test.foo.bar.com.au-error_log CustomLog logs/test.foo.bar.com.au-access_log common <Directory /home/test/public_html> AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps php_admin_value open_basedir /home/test/public_html php_admin_value user_dir /home/test/public_html php_admin_value disable_functions phpinfo php_admin_flag safe_mode On php_admin_value safe_mode_allowed_env_vars PHP_ php_admin_value safe_mode_protected_env_vars LD_LIBRARY_PATH php_admin_value sendmail_from testfoo.bar.com.au </Directory> </VirtualHost>

    What am I doing wrong, any suggestions welcome on the above conf too :)

    Thanks in advance,

    Joseph

    attached mail follows:


    On Thursday 25 October 2001 09:47, Joseph Blythe wrote: Hi, bad news disable_functions doesn't work for me either in apache's config file I tried it with php_value, and php_admin_value, also in .htaccess with php_value without any luck

    php4.0.5, Apache/1.3.14

    bye, Arpi

    > Hey All, > > Was just trying the following and disable_functions is not working? > Although safe mode and open_basedir are! What is really strange > that when phpinfo is called the disable_functions value is phpinfo, > can't seem to disable echo either, I don't want to put these in > php.ini as I still want to be able to have a fully fledged php > running from the main document root. > > <VirtualHost *> > ServerAdmin foobar.com.au > DocumentRoot /home/test/public_html > ServerName test.foo.bar.com.au > ErrorLog logs/test.foo.bar.com.au-error_log > CustomLog logs/test.foo.bar.com.au-access_log common > <Directory /home/test/public_html> > AddType application/x-httpd-php .php > AddType application/x-httpd-php-source .phps > php_admin_value open_basedir /home/test/public_html > php_admin_value user_dir /home/test/public_html > php_admin_value disable_functions phpinfo > php_admin_flag safe_mode On > php_admin_value safe_mode_allowed_env_vars PHP_ > php_admin_value safe_mode_protected_env_vars LD_LIBRARY_PATH > php_admin_value sendmail_from testfoo.bar.com.au > </Directory> > </VirtualHost> > > What am I doing wrong, any suggestions welcome on the above conf > too :) > > Thanks in advance, > > Joseph

    attached mail follows:


    Hi there,

    I am camping with a little regular expressions problem...

    Problem: I want to check if $variable begins with a * (star), and it doesn't matter if it starts with plenty of spaces...

    My solution: ereg("^[:space:]*\*",$variable)

    But, it doesn't seem to work with the space part... The regex:

    ereg("^\*",$variable)

    does work, but that doesn't include spaces at the start... How can I extend this one so that it doesn't matter if there are a lot of spaces at the begin?

    Thanks in advance,

    Leon Mergen

    attached mail follows:


    Hello Leon,

    try this

    if (preg_match("/^([[:space:]]*)?\*/s", $string)) { echo "Match."; } else { echo "No match"; }

    James

    "Leon Mergen" <leonblazebox.com> wrote in message news:002f01c15d2a$e4ca3030$012aa8c0leon... Hi there,

    I am camping with a little regular expressions problem...

    Problem: I want to check if $variable begins with a * (star), and it doesn't matter if it starts with plenty of spaces...

    My solution: ereg("^[:space:]*\*",$variable)

    But, it doesn't seem to work with the space part... The regex:

    ereg("^\*",$variable)

    does work, but that doesn't include spaces at the start... How can I extend this one so that it doesn't matter if there are a lot of spaces at the begin?

    Thanks in advance,

    Leon Mergen

    attached mail follows:


    > My solution: > ereg("^[:space:]*\*",$variable)

    Try ereg("^[:space:]\**$",$variable) or ereg("^[ ]*\**$",$variable) or ereg("^[[:space:]]*\**$",$variable)

    attached mail follows:


    $sNoSpaces = ltrim($variable); if ('*' == $sNoSpaces[0]) ....

    --
    

    Regards, ---------------------------------------------- Calin Uioreanu calinciao-ag.com Tel: +49 - (0) 89 - 25 55 17 23 http://www.ciao.com ---------------------------------------------- "Leon Mergen" <leonblazebox.com> wrote in message news:002f01c15d2a$e4ca3030$012aa8c0leon... Hi there,

    I am camping with a little regular expressions problem...

    Problem: I want to check if $variable begins with a * (star), and it doesn't matter if it starts with plenty of spaces...

    My solution: ereg("^[:space:]*\*",$variable)

    But, it doesn't seem to work with the space part... The regex:

    ereg("^\*",$variable)

    does work, but that doesn't include spaces at the start... How can I extend this one so that it doesn't matter if there are a lot of spaces at the begin?

    Thanks in advance,

    Leon Mergen

    attached mail follows:


    why does

    <? $qty = "0" ; if ($qty != "test") print "qty is not test"; ?>

    work properly but not the following

    <? $qty = 0 ; if ($qty != "test") print "qty is not test"; ?>

    Thanks,

    Robin

    attached mail follows:


    Hello Robin,

    Very simple. :)

    RC> <? $qty = "0" ; if ($qty != "test") print "qty is not test"; ?>

    $qty is string, so PHP compares "0" with "test" char by char. chr("0") isn't equal "t".

    RC> <? $qty = 0 ; if ($qty != "test") print "qty is not test"; ?>

    In this case $qty is integer value, so PHP tries to convert "test" to integer value [ integer("test") == 0], so last condition result is FALSE. Is it clear?

    RC> Thanks, RC> Robin

    -- 
    Best regards,
    Vitali Falileev                          mailto:falileevitos.eu.org
    

    attached mail follows:


    The only reason I could see that not working is if PHP is typecasting "test" to (int) in the second example...

    $qty = "0"; (string) "test" = "test"; (string) "0" != "test" (evaluates true)

    $qty = 0; (int) "test" = 0; (when cast to int) 0 != 0 (evaluates false)

    e.g. By comparing an int to a string in the 2nd example, the string is casted to int, and the int cast of "test" is 0.

    -----Original Message----- From: Robin Chen [mailto:robinchevividnet.com] Sent: Thursday, October 25, 2001 4:06 AM To: php-generallists.php.net Subject: [PHP] = 0 and = "0"

    why does

    <? $qty = "0" ; if ($qty != "test") print "qty is not test"; ?>

    work properly but not the following

    <? $qty = 0 ; if ($qty != "test") print "qty is not test"; ?>

    Thanks,

    Robin

    -- 
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    <? $qty = "0" ; if ($qty != "test") print ("qty is not test"); ?> <? $qty = 0 ; if ($qty != "test") printf("qty is not test"); ?>

    I just tested those two lines with php 4.0.6 and they both work.

    There is a difference though. If you set $qty=0; then $qty has no value. But if you set $qty="0", it has a value.

    Type casting is irrelevant in php.

    attached mail follows:


    > If you set $qty=0; then $qty has no value.

    Of course it has a value. The value is 0. Quite distinct from not having a value, or in proper terms, not being set. Try this:

    var_dump($qty); $qty = 0; var_dump($qty);

    Well, I will save you the trouble, it outputs:

    NULL int(0)

    > Type casting is irrelevant in php.

    No they aren't. Try this:

    $qty = 0; if($qty=="test") echo "foo"; if((string)$qty=="test") echo "bar";

    This will only output "foo". Not "bar". You could also use the === operator to force PHP to check not only the value but also the type.

    See http://www.php.net/manual/en/language.operators.comparison.php

    -Rasmus

    attached mail follows:


    > > If you set $qty=0; then $qty has no value. > > Of course it has a value.

    No it doesn't have a value. PHP interprets 0 as null.

    A very easy way for you to check:

    $value=0;

    if(!$value) printf("$value doesn't have a value (it didn't even print 0)<br>\n");

    $value="0" if($value) printf("$value does have a value if I put "0" instead of 0<br>\n");

    attached mail follows:


    Thank you, that was it. I needed to test the variable against both an integer and a string, so I ended up using (string) when I need to compare a string. Rest of the time, it's an integer.

    Robin

    Rasmus Lerdorf wrote: > > > If you set $qty=0; then $qty has no value. > > Of course it has a value. The value is 0. > Quite distinct from not having a value, or in proper terms, not being set. > Try this: > > var_dump($qty); > $qty = 0; > var_dump($qty); > > Well, I will save you the trouble, it outputs: > > NULL > int(0) > > > Type casting is irrelevant in php. > > No they aren't. Try this: > > $qty = 0; > if($qty=="test") echo "foo"; > if((string)$qty=="test") echo "bar"; > > This will only output "foo". Not "bar". You could also use the === > operator to force PHP to check not only the value but also the type. > > See http://www.php.net/manual/en/language.operators.comparison.php > > -Rasmus > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net

    attached mail follows:


    The integer 0 is equal to False, but not Null.

    Robin

    Kodrik wrote: > > > > If you set $qty=0; then $qty has no value. > > > > Of course it has a value. > > No it doesn't have a value. > PHP interprets 0 as null. > > A very easy way for you to check: > > $value=0; > > if(!$value) printf("$value doesn't have a value (it didn't even print > 0)<br>\n"); > > $value="0" > if($value) printf("$value does have a value if I put "0" instead of 0<br>\n"); > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net

    attached mail follows:


    Kodrik, you are picking the wrong person to argue with. ;)

    > > > If you set $qty=0; then $qty has no value. > > > > Of course it has a value. > > No it doesn't have a value. > PHP interprets 0 as null.

    Completely incorrect.

    > A very easy way for you to check: > > $value=0; > > if(!$value) printf("$value doesn't have a value (it didn't even print > 0)<br>\n");

    if() doesn't check for null, it checks for a boolean false condition. Does 0 evaluate to false? Sure it does. So does "" and "0". That doesn't mean they are null.

    > $value="0" > if($value) printf("$value does have a value if I put "0" instead of 0<br>\n");

    That is completely wrong as well. You obviously didn't try your own example. The following all evaluate to false:

    if(0) if(false) if(null) if("0") if("")

    But the fact that they all evaluate to false says nothing about whether they are values or not. Just like all of these all evaluate to true:

    if(1) if(true) if("abc") if(-1)

    That doesn't mean that 0 == null anymore than it means that 1 == -1. Just because two values both evaluate to the same boolean state does not mean they are one and the same.

    -Rasmus

    attached mail follows:


    You are right, "0" didn't show as a value.

    But his two lines still don't need typecasting, they both work: http://24.234.52.166

    attached mail follows:


    > The integer 0 is equal to False, but not Null.

    Not quite true. 0 evaluates to false. They are not equal. Try this:

    if(0==false) echo "1"; if(0===false) echo "2";

    You will find that this only prints "1". 0 and false are distinct and separate values. This is something that confuses a lot of people, especially in conjunction with something like the strpos() function which will return 0 when it matches something at position 0 in the string, but it returns false when there is no match. A lot of people will mistakenly do:

    if(strpos("abcdef","abc")) { ... }

    and then be confused that the condition appeared not to be met. What they actually should have done was:

    if(strpos("abcdef","abc")!==false) { ... }

    So be careful and try to think of 0 and false as distinct and separate entities and you will avoid coding mistakes like this.

    -Rasmus

    > > Robin > > Kodrik wrote: > > > > > > If you set $qty=0; then $qty has no value. > > > > > > Of course it has a value. > > > > No it doesn't have a value. > > PHP interprets 0 as null. > > > > A very easy way for you to check: > > > > $value=0; > > > > if(!$value) printf("$value doesn't have a value (it didn't even print > > 0)<br>\n"); > > > > $value="0" > > if($value) printf("$value does have a value if I put "0" instead of 0<br>\n"); > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > > For additional commands, e-mail: php-general-helplists.php.net > > To contact the list administrators, e-mail: php-list-adminlists.php.net > >

    attached mail follows:


    > You are right, "0" didn't show as a value. > > But his two lines still don't need typecasting, they both work: > http://24.234.52.166

    I don't mean to pick on you, but no, you are wrong. And I am only doing this because so many people get confused on this point and I always see questions related to it.

    His lines were:

    $qty = "0" ; if ($qty != "test") print "qty is not test"; $qty = 0 ; if ($qty != "test") print "qty is not test";

    So his two conditions can be simplified to:

    if("0"!="test") echo 1; if(0!="test") echo 2;

    Try this code yourself, or his original code if you want. Only the first condition is met and you will only see it print 1.

    When you are comparing an integer to a string, the string will get converted to its integer representation. The integer representation of "test" is 0. So the second condition becomes:

    if(0!=0)

    which is obviously false. Therefore if you cast it:

    if((string)0!="test")

    You are again comparing a string to a string and PHP will not try to convert "test" to an integer.

    -Rasmus

    attached mail follows:


    Check the link I posted. http://24.234.52.166 There is the code I wrote and it's output. The two lines print. You can explain me why tomorrow they print on my server and not yours.

    Good night

    > > But his two lines still don't need typecasting, they both work: > > http://24.234.52.166 > > I don't mean to pick on you, but no, you are wrong. And I am only doing > this because so many people get confused on this point and I always see > questions related to it.

    attached mail follows:


    On Wednesday 24 October 2001 14:33, _lallous wrote: > I think that the MySql's API allow to many queries to be executed w/o > having an open connection, example: > SELECT 1+1; > > how can i issue such statments w/o opening a connection? > > like SELECT NOW() ...... > > whenever I first run mysql_query() it tries to connect w/ default > connection settings.

    try adding the mysql_telepathy extension

    (seriously - how should the data get to and from mysql without a connection?)

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

    /* you are not expected to understand this */

    - from the UNIX V6 kernel source

    attached mail follows:


    > how can i issue such statments w/o opening a connection?

    I you don't open a connection, how is mysql supposed to know which db you are talking to?

    attached mail follows:


    On Wednesday 24 October 2001 15:35, Victor Hugo Oliveira wrote: > Does anyone know a way to share an object with all sessions ? > The idea is to access the same database connection poll.

    poll or pool?

    if pool: simply use persistent connections

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

    /* you are not expected to understand this */

    - from the UNIX V6 kernel source

    attached mail follows:


    On Wednesday 24 October 2001 20:26, Michael George wrote:

    [...] > The function is called after a form submission from HTML. When I enter > 12 14 > I get: > ----------------------------------------------------------------------- >-------- lookupProduct( 12, 14 ) > $partNum: 12 does appear to be a number, and not a double > $serial: 14 does appear to be a number, and not a double > ----------------------------------------------------------------------- >-------- > > When I enter > 12.5 14.8 > I get: > ----------------------------------------------------------------------- >-------- lookupProduct( 12.5, 14.8 ) > $partNum: 12 does appear to be a number, and not a double > $serial: 14 does appear to be a number, and not a double > ----------------------------------------------------------------------- >-------- > > Why is the function is_double() failing? I have an analagous problem > with the is_int() function.

    You get both values as strings from the form. is_numeric checks if the variable is in some was a number (and returns true because it actually is a string representation of a number). is_int and is_double check whether the variable's current datatype actually is "int" or "double" See the manual.

    Possible solution: if (is_numeric ($a)) { $a = (double) $a; if (intval ($a) == $a) echo "'$a' is integer"; else echo "'$a' is double"; }

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

    /* you are not expected to understand this */

    - from the UNIX V6 kernel source

    attached mail follows:


    On Wednesday 24 October 2001 23:33, Jason Caldwell wrote: > That won't work, as that will only unset the *value* not the *element*.

    Try again:

    $myArray = array('100'=>'jibberjabber','200'=>'morejibberjabber','0'=>'----');

    var_dump ($myArray); echo "<br>"; if(isset($myArray[0])) { unset ($myArray [0]); }

    var_dump ($myArray);

    Outputs:

    array(3) { [100]=> string(12) "jibberjabber" [200]=> string(16) "morejibberjabber" [0]=> string(4) "----" } array(2) { [100]=> string(12) "jibberjabber" [200]=> string(16) "morejibberjabber" }

    -> index 0 is gone.

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

    /* you are not expected to understand this */

    - from the UNIX V6 kernel source