OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general-digest-help_at_lists.php.net
Date: Sat Feb 01 2003 - 18:36:24 CST

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

    php-general Digest 2 Feb 2003 00:36:24 -0000 Issue 1858

    Topics (messages 133866 through 133940):

    Re: Function Stack
            133866 by: Matt
            133881 by: Michael Sims

    Re: question on listbox.
            133867 by: Matt
            133873 by: Denis L. Menezes
            133875 by: Jason Wong
            133879 by: Leonard Burton

    Re: Strange problem
            133868 by: Jason Wong
            133870 by: Matt

    Re: Form Processing - Multiple inputs of the same name
            133869 by: Mike Potter

    PHP3 Web Architecture Framework
            133871 by: karthikeyan.balasubramanian
            133872 by: Jason Wong
            133936 by: michael kimsal

    Re: Strange_session-problem_with_php-file_in_<img_src…
            133874 by: Victor Spĺng Arthursson

    Time Delay?
            133876 by: OjMyStEr
            133878 by: Jason Wong

    pause_script($int)??
            133877 by: OjMyStEr
            133880 by: Stephan Seidt

    Re: reading attachmentsl
            133882 by: Bartosz Matosiuk
            133884 by: Jason Wong
            133886 by: Bartosz Matosiuk

    Re: Using custom "button" form element instead of standard "submit"?
            133883 by: Durwood Gafford

    Calling other php scripts from inside a php script.
            133885 by: Jason Howlett
            133889 by: Greg Beaver
            133906 by: Sunfire

    Sort List But NOT After Date Has Passed.
            133887 by: Randum Ian

    MySQL/PHP Associative Array Insert
            133888 by: CDitty
            133897 by: . Nilaab
            133898 by: . Nilaab
            133902 by: Thomas Seifert

    Re: Screen Size detect??
            133890 by: Nigel Powell
            133940 by: Sean Malloy

    select unique values from an array
            133891 by: Peter Gumbrell
            133893 by: janet.valade.com

    connecting to oracle 9i as user SYS
            133892 by: Lukas Smith

    File upload problem
            133894 by: Tomator
            133899 by: David Rice

    Re: Delete files via PHP
            133895 by: Miguel Brás

    Long Email - Array Problems Causing My Baldness
            133896 by: Guru Geek

    Passing Variables
            133900 by: Beauford.2002
            133901 by: Philip Olson

    selecting items from an array
            133903 by: Peter Gumbrell

    help needed building query string based on which form fields that are filled.
            133904 by: anders thoresson

    any change to see php source?
            133905 by: qt
            133907 by: Philip Olson
            133915 by: Chris Hayes

    using <input> tags with php
            133908 by: Sunfire
            133914 by: janet.valade.com
            133924 by: Sunfire
            133928 by: janet.valade.com
            133929 by: Sunfire

    Need to set default parameter || How to do in PHP?
            133909 by: CF High
            133911 by: Philip Olson
            133912 by: peio popov
            133921 by: CF High

    Installation Problem
            133910 by: fdo cruz

    Possible PHP/MySQL Bug?
            133913 by: Tim Lan
            133917 by: Thomas Seifert
            133918 by: Tim Lan
            133920 by: Thomas Seifert
            133922 by: Tim Lan

    Need an explanation as to what this line does...
            133916 by: Phil Powell
            133926 by: John W. Holmes

    Loading CSV data into MySQL
            133919 by: Brian V Bonini
            133923 by: Thomas Seifert
            133927 by: John W. Holmes
            133932 by: Brian V Bonini
            133933 by: Brian V Bonini
            133937 by: Thomas Seifert

    PHP.ini help on Linux
            133925 by: Nicole

    Redeclare formatdate
            133930 by: Miguel Brás
            133931 by: John W. Holmes
            133934 by: Jason Sheets
            133935 by: Miguel Brás

    Re: using <input> tags with php (IMPORTANT READ)
            133938 by: Philip Olson
            133939 by: Sunfire

    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:


    ----- Original Message -----
    From: "Joshua Moore-Oliva" <joshchatgris.com>
    To: <php-generallists.php.net>
    Sent: Saturday, February 01, 2003 7:08 AM
    Subject: [PHP] Function Stack

    > Is there any way to access the Function Stack from php?

    Not built in, but you could manually add statement to do it yourself.

    attached mail follows:


    On Sat, 1 Feb 2003 07:08:05 -0500, you wrote:

    >Is there any way to access the Function Stack from php?

    Starting with PHP 4.3.0 you can use debug_backtrace(), which returns
    an array of caller stack information. You might want to build a
    wrapper around it which formats the information the way you want. I
    use it in my custom error handler and it's a lifesaver!

    attached mail follows:


    ----- Original Message -----
    From: "Denis L. Menezes" <menezesdsingnet.com.sg>
    To: "PHP general list" <php-generallists.php.net>
    Sent: Saturday, February 01, 2003 6:08 AM
    Subject: [PHP] question on listbox.

    Hello friends.

    >I have a listbox which I populate from a query with the database. It is
    >working fine. But additinally, I want the first item to be "Select
    category". >Can someone please help me how to modify by below written code
    to do > the above?

    something like this would do it:
    $valueToSelect = 'foo';
    {
     Print("<OPTION VALUE=\"{$Category[0]}\"
     $selected = ($Category[0] == $valueToSelect) ? ' selected' : '';
     Print($selected);
     Print(">{$Category[0]}\n");
    }

    attached mail follows:


    Thanks Jason.

    Looks like I am too dumb. I still cannot do it. can u please help me
    further?

    Thanks
    Denis
    ----- Original Message -----
    From: "Jason Wong" <php-generalgremlins.biz>
    To: <php-generallists.php.net>
    Sent: Saturday, February 01, 2003 8:21 PM
    Subject: Re: [PHP] question on listbox.

    > On Saturday 01 February 2003 19:08, Denis L. Menezes wrote:
    > > Hello friends.
    > >
    > > I have a listbox which I populate from a query with the database. It is
    > > working fine. But additinally, I want the first item to be "Select
    > > category". Can someone please help me how to modify by below written
    code
    > > to do the above?
    > >
    > > My code : Quote :
    > >
    > >
    > > <?php
    > > //connecting to the database
    > > $link = mysql_connect("localhost","MyDomain","MyPass");
    > > if ($link){
    > > Print "";
    > > } else {
    > > Print "No connection to the database";
    > > }
    > > if (!mysql_select_db("MyDomain_com")){
    > > Print "Couldn't connect database";
    > > } else {
    > > Print ""."<br>\n";
    > > }
    >
    > echo "<option ...";
    >
    > > $sql="SELECT DISTINCT CategoryName From Categories ORDER BY
    CategoryName";
    > > $result=mysql_query($sql);
    > >
    > > While($Category=mysql_fetch_array($result))
    > > {
    > > Print("<OPTION VALUE=\"$Category[0]\">$Category[0]\n");
    > > }
    > >
    > > ?>
    > >
    > > Unquote
    >
    > --
    > Jason Wong -> Gremlins Associates -> www.gremlins.biz
    > Open Source Software Systems Integrators
    > * Web Design & Hosting * Internet & Intranet Applications Development *
    > ------------------------------------------
    > Search the list archives before you post
    > http://marc.theaimsgroup.com/?l=php-general
    > ------------------------------------------
    > /*
    > If you are good, you will be assigned all the work. If you are real
    > good, you will get out of it.
    > */
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    On Saturday 01 February 2003 20:40, Denis L. Menezes wrote:

    Please don't top-post.

    > Looks like I am too dumb. I still cannot do it. can u please help me
    > further?

    I could write out the complete code for you -- but then I'll have to charge
    you for it :-)

    OTOH I can walk you through the process (in doing so it will, hopefully, help
    you solve your own problems) -- not that there is much of a process as it is
    frankly, really basic HTML.

    > > > I have a listbox which I populate from a query with the database. It is
    > > > working fine. But additinally, I want the first item to be "Select
    > > > category". Can someone please help me how to modify by below written
    >
    > code
    >
    > > > to do the above?

    Can I assume that you are at least familiar with basic HTML? If not, then you
    really ought get up to speed on HTML before playing with PHP.

    OK, you want to display a select box. A properly written select box would look
    something like:

      <select name="category">
        <option value="0000000028">Basket</option>
        <option value="0000000021">Bathroom</option>
        <option value="0000000008">Bird feeder</option>
      </select>

    You want to add an extra option to it, AND you want the extra item to be
    displayed first, so it would now look like:

      <select name="category">
        <option value="%">ANY CATEGORY</option>
        <option value="0000000028">Basket</option>
        <option value="0000000021">Bathroom</option>
        <option value="0000000008">Bird feeder</option>
      </select>

    So, look at your code and determine how/where you would insert that extra
    item. I've already indicated previously _where_ the extra code should go, and
    also hinted at _how_. It is a simple matter for you to fill in the blanks (or
    ... to be precise).

    Also, do note that your code at present does not output well formed HTML. You
    may want to fix that.

    > > > My code : Quote :
    > > >
    > > >
    > > > <?php
    > > > //connecting to the database
    > > > $link = mysql_connect("localhost","MyDomain","MyPass");
    > > > if ($link){
    > > > Print "";
    > > > } else {
    > > > Print "No connection to the database";
    > > > }
    > > > if (!mysql_select_db("MyDomain_com")){
    > > > Print "Couldn't connect database";
    > > > } else {
    > > > Print ""."<br>\n";
    > > > }
    > >
    > > echo "<option ...";
    > >
    > > > $sql="SELECT DISTINCT CategoryName From Categories ORDER BY
    >
    > CategoryName";
    >
    > > > $result=mysql_query($sql);
    > > >
    > > > While($Category=mysql_fetch_array($result))
    > > > {
    > > > Print("<OPTION VALUE=\"$Category[0]\">$Category[0]\n");
    > > > }
    > > >
    > > > ?>
    > > >
    > > > Unquote

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.biz
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    ------------------------------------------
    Search the list archives before you post
    http://marc.theaimsgroup.com/?l=php-general
    ------------------------------------------
    /*
    "I hope you will find the courage to keep on living
     despite the existence of this feature."
    

    - Richard Stallman */

    attached mail follows:


    Might this be better?

    print "<select name=category_selection>\n"; print "<option value=0>Select Category</option>"\n

    //Query $sql="SELECT DISTINCT CategoryName From Categories ORDER BY CategoryName"; $result=mysql_query($sql); if ($result) { While($Category=mysql_fetch_array($result)) { Print"<OPTION VALUE=\"$Category['auto']\">$Category['name']</option>\n"; } mysql_free_result($result[$a]); print "</select>\n"; }

    Leonard. www.phpna.com

    attached mail follows:


    On Saturday 01 February 2003 20:08, Denis L. Menezes wrote: > Hello friends. > > I have the following script. Both the errors show green font when actually > the first error should give a red font. Am I doing something wrong here? > > Quote: > > > if($CategoryName==""){ > Print "<font color=\#FF0000\">You have not entered the category name. > Please go back and enter the category name.</font>"; Exit; > } > if($password==""){ > Print "<font color=\#00FF00\">You have not entered the password. Please > go back and enter the password.</font>"; Exit; > } > > > Unquote

    Have a look the HTML output resulting from the above code.

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.biz
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    ------------------------------------------
    Search the list archives before you post
    http://marc.theaimsgroup.com/?l=php-general
    ------------------------------------------
    /*
    The herd instinct among economists makes sheep look like independent thinkers.
    */
    

    attached mail follows:


    ----- Original Message ----- From: "Denis L. Menezes" <menezesdsingnet.com.sg> To: "PHP general list" <php-generallists.php.net> Sent: Saturday, February 01, 2003 7:08 AM Subject: [PHP] Strange problem

    > I have the following script. Both the errors show green font when actually > the first error should give a red font. Am I doing something wrong here?

    Have you looked at the html? That green shows up with the color setting is screwed up.

    attached mail follows:


    This worked perfectly. Thank you.

    As for the FAQ, I looked, but I guess not in the right place!

    Mike

    "Tracy Finifter Rotton" <tracytaupecat.com> wrote in message news:BA600C91.560F%tracytaupecat.com... > Change the name of your checkboxes in your HTML to something like: > > name="DeleteIDs[]" > > This will make it an array, and you can access all the elements like > > $_POST['DeleteIDs'][0] > > etc. > > > > (This should really be in a FAQ somewhere...) > > -- tracy > > On 1/31/03 11:17 AM, "Mike Potter" <mikemikenbob.com> wrote: > > > Is it possible to pass an group of input boxes of the same name, then get > > the values of all the checked boxes or filled out textboxes? > > How do I get ALL the IDs passed. Right now it only passes the last ID. Do > > I really have to give them all unique names? > > > > For example... > > > > <html> > > <head> > > </head> > > <body> > > <form action="testform.php" method="post"> > > <input type="checkbox" value="0" name="DeleteIDs"></input> Jon Smith<br> > > <input type="checkbox" value="1" name="DeleteIDs"></input> David Callow<br> > > <input type="checkbox" value="2" name="DeleteIDs"></input> Peter Parker<br> > > . > > . > > . > > <input type="submit" value="Delete Users"> > > </form> > > </body> > > </html> > > > > This list of DeleteIDs will be build dynamically. I want the user to be > > able to check the boxes they want to delete and pull the IDs on the posted > > page. > > > > How do I get ALL the IDs passed. Right now it only passes the last ID. > > > > Thanks, > > > > Mike > > > > > > -- > Tracy F. Rotton > tracytaupecat.com > http://www.taupecat.com/ > > "... I like the 49ers because they're pure of heart, > Seattle because they've got something to prove, > and the Raiders because they always cheat." > -- Lisa Simpson, "Lisa the Greek" >

    attached mail follows:


    Hi,

    I browsed the web for many different web architecture and frameworks. I found many Interesting but all wants latest version of PHP at least PHP 4.0.6. I dont want to upgrade the PHP Version(4.0.5) that i have because many clients are using it and i dont want to mess it up. Its a Pain in PHP that to support any extension we need to recompile with appropriate extensions unlike Java where all you need to do is put the appropriate Jar files in the /Lib directory and it automatically gets SET in the classpath and works great but I do ADORE PHP for its ease and efficiency and ofcourse along with Apache it rocks. So please dont suggest me to upgrade my PHP or something other.

    Few of the techniques i was pretty impressed is

    1) Smarty - which ofcourse says that it needs PHP 4.0.6 or higher for its latest release 2) Tadpole PHPTags - which ofcourse didnt work on PHP4.0.5 3) Pear which ofcourse needed recompilation with Pear support 4) PHPMVC but it also requires latest version of PHP

    What i m planning to do is follow PHP3 method of Coding. The version of PHP that i have is 4.0.5. Can somebody suggest Struts like framework for PHP3 type of coding.

    Hope i do make sense if not please comment. I will explain more.

    Have a great day.

    Karthikeyan.

    attached mail follows:


    On Saturday 01 February 2003 20:23, karthikeyan.balasubramanian wrote:

    > I browsed the web for many different web architecture and frameworks. I > found many Interesting but all wants latest version of PHP at least PHP > 4.0.6. I dont want to upgrade the PHP Version(4.0.5) that i have because

    [snip]

    > What i m planning to do is follow PHP3 method of Coding. The version of > PHP that i have is 4.0.5. Can somebody suggest Struts like framework for > PHP3 type of coding.

    Have a look at phplib.

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.biz
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    ------------------------------------------
    Search the list archives before you post
    http://marc.theaimsgroup.com/?l=php-general
    ------------------------------------------
    /*
    There will be big changes for you but you will be happy.
    */
    

    attached mail follows:


    Karthikeyan.Balasubramanian wrote: > Hi, > > I browsed the web for many different web architecture and frameworks. I > found many Interesting but all wants latest version of PHP at least PHP > 4.0.6. I dont want to upgrade the PHP Version(4.0.5) that i have because > many clients are using it and i dont want to mess it up. Its a Pain in PHP > that to support any extension we need to recompile with appropriate > extensions unlike Java where all you need to do is put the appropriate Jar > files in the /Lib directory and it automatically gets SET in the classpath > and works great but I do ADORE PHP for its ease and efficiency and ofcourse > along with Apache it rocks. So please dont suggest me to upgrade my PHP or > something other. >

    Maybe you shouldn't publicly talk about how you and your clients are sticking with php4.0.5. It has known security holes, which is just one of many reasons to upgrade. You *will* spend much more time coding trying to make stuff work in PHP3 and early PHP4 than you will by taking advantage of relatively modern PHP4 versions. Session handling is something which comes to mind, and improved array handling. There will be things you can do in a few lines of code in recent versions of PHP4 that you simply won't be able to do at all, or not without *much* more work than it's worth.

    PHPGroupware.org *might* work for you. I know that there was a stated goal of their code working on PHP3 and PHP4 installations. I found that somewhat strange, but it was a goal. It may not be anymore.

    For *new* development, it doesn't make much sense to use the old stuff. If you're running older versions and people have apps that are running fine, that's another story, but even in those cases, the security exploits make it an unwise strategy for the long term.

    "Pear which ofcourse needed recompilation with Pear support"

    I don't think PEAR does require any recompilation. Certainly with most of the PEAR stuff you can just use the source code and it'll work fine. I would be very surprised if there wasn't at least SOME PEAR code which required PHP4.0.6 or higher.

    You don't need to recompile all of PHP, or at least you don't need to place the entire recompiled version of PHP into Apache again. You can usually compile "SO" files (shared object files) which you can dl() or put in php.ini.

    ./configure --with-gd=shared

    for example, will make a gd.so file suitable for dl() use.

    "So please dont suggest me to upgrade my PHP or something other."

    Sorry, if you get many responses, at least some will suggest you upgrade. This is like saying you drive a 6 year old car (equivalent in internet time!) and that you *won't* get a newer car (cause your passengers like the seats in the old car) but you want all the benefits of a new engine. The fact that the car has known safety hazards and that a new car is essentially free aren't supposed to factor in to this? True, your passengers may have to adjust to new seats, and they may not like those seats as much as the old ones, but they'll have a safer ride, and you'll have a new, more powerful engine.

    I just can't think of too many valid reasons to not be running at least PHP4.1.x, if not 4.2. 4.3 has only been out for a few weeks, and I don't expect too many people to be running that yet.

    Most *interesting* development work in PHP regarding frameworks involves people who are somewhat on the cutting edge, using recent technology. They are most likely not going to bother trying to support PHP4.0.5 and below.

    Good luck.

    attached mail follows:


    Problem solved. The error came because I was calling the function inside another function, outside the latter it worked good. So I simply passed the variable with the second function - works great!

    Thanks anyway for all your time trying to help me!

    /V

    attached mail follows:


    Hi, Does anyone know if there is a way for me to produce a function in PHP to pause the processing of the script for 3 seconds for example without eating up the CPU bandwidth. I could do with quite accurate control. Is there a better way that doing it like this:

    <?php

    function pause_script($int){ $start_time = time(); while(time() <= ($start_time+$int)){ // No functions take place inside the loop! } }

    echo "The current time is " . time() . "\n"; pause_script(10); echo "The current time is " . time() . "\n";

    ?>

    The output is: The current time is 1044105730 The current time is 1044105741

    There is obviously an 11 second difference is the time that the two seperate lines were printed. Thing is, when I run this script the CPU usage goes to 100%

    Anyone got any ideas?

    Thanx

    Josh

    attached mail follows:


    On Saturday 01 February 2003 21:27, OjMyStEr wrote: > Hi, > Does anyone know if there is a way for me to produce a function in PHP to > pause the processing of the script for 3 seconds for example without eating > up the CPU bandwidth. I could do with quite accurate control. Is there a > better way that doing it like this:

    [snip]

    Try sleep().

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.biz
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    ------------------------------------------
    Search the list archives before you post
    http://marc.theaimsgroup.com/?l=php-general
    ------------------------------------------
    /*
    We wish you a Hare Krishna
    We wish you a Hare Krishna
    We wish you a Hare Krishna
    And a Sun Myung Moon!
    		-- Maxwell Smart
    */
    

    attached mail follows:


    Hi, Does anyone know if there is a way for me to produce a function in PHP to pause the processing of the script for 3 seconds for example without eating up the CPU bandwidth. I could do with quite accurate control. Is there a better way that doing it like this:

    <?php

    function pause_script($int){ $start_time = time(); while(time() <= ($start_time+$int)){ // No functions take place inside the loop! } }

    echo "The current time is " . time() . "\n"; pause_script(10); echo "The current time is " . time() . "\n";

    ?>

    The output is: The current time is 1044105730 The current time is 1044105741

    There is obviously an 11 second difference is the time that the two seperate lines were printed. Thing is, when I run this script the CPU usage goes to 100%

    Anyone got any ideas?

    Thanx

    Josh

    attached mail follows:


    what about sleep() ?

    OjMyStEr wrote: > Hi, > Does anyone know if there is a way for me to produce a function in PHP to > pause the processing of the script for 3 seconds for example without eating > up the CPU bandwidth. I could do with quite accurate control. Is there a > better way that doing it like this: > > <?php > > function pause_script($int){ > $start_time = time(); > while(time() <= ($start_time+$int)){ > // No functions take place inside the loop! > } > } > > echo "The current time is " . time() . "\n"; > pause_script(10); > echo "The current time is " . time() . "\n"; > > ?> > > The output is: > The current time is 1044105730 > The current time is 1044105741 > > There is obviously an 11 second difference is the time that the two seperate > lines were printed. > Thing is, when I run this script the CPU usage goes to 100% > > Anyone got any ideas? > > Thanx > > Josh > > > >

    -- 
    IPv6 + TCPA + wrecked Palladium server = NO COFFE!
    

    attached mail follows:


    hi well actually I know what is the mechanism of sending mime messages with atttachments works, the problem is that I don't know how to to read attachment. I tried to use Pear decode functions but it only gives me info that there are attachments in the message which is obviosly not enough.

    so I'm putting my question once again: how to read attachment from the mime message and how to save it on client hard drive???

    thanks for any help brtek

    Uzytkownik "Chris Hayes" <chayesantenna.nl> wrote > At 11:11 31-1-2003, you wrote: > >hi all > > > > I'm writing a mail client and I got problem with attachments. I have no > >idea how to read and save attachments. Mayby someone already did something > >like that a can help me with some advice or giving me link to some > >resourses. > Maybe it helps to see how an attachment is send, then you can try to > reverse the process to read in attachments. > > > assume that $filedata holds the data you want to attach > the encoding can done in many ways, so read the headers carefully > > //prepare mail body > $filedata = chunk_split(base64_encode($filedata)); > $type = "application/octet-stream"; > $encoding = "base64"; > mt_srand((double)microtime()*1000000); > $boundary = '--b'.md5(uniqid(mt_rand())) . getmypid(); //so the > boundary line can be quite diverse > $mailbody = "From: PHP backup script by Arakrys\n" > ."MIME-Version: 1.0\n" > ."Content-Type: multipart/mixed; " > ."boundary=\"$boundary\"\n\n" > ."This is a MIME encoded message. \n\n" > ."--$boundary\n" > ."Content-Type: text/plain"; > //if ($this->charset != "") $mailbody .= "; charset=$this->charset"; > $mailbody .="\n" > ."Content-Transfer-Encoding: 8bit\n\n" > .$message . "\n\n\n--$boundary"; > $data = "Content-Type: $type"."; name = \"$filename\"" > ."\n" ."Content-Transfer-Encoding: $encoding" > ."\n\n$filedata\n"; > $mailbody .= "\n$data\n--$boundary" > ."--\n"; > > //send mail > mail($mailto, $MYSQL_DB.' database backup '.date("d M Y H:i"), ' ', > $mailbody) or die ('Could not send email!'); > } >

    attached mail follows:


    On Saturday 01 February 2003 23:21, Bartosz Matosiuk wrote:

    > well actually I know what is the mechanism of sending mime messages > with atttachments works, the problem is that I don't know how to to read > attachment. I tried to use Pear decode functions but it only gives me info > that there are attachments in the message which is obviosly not enough. > > so I'm putting my question once again: how to read attachment from the > mime message and how to save it on client hard drive???

    1) You can see whether the functions in "IMAP, POP3 and NNTP functions" are of any use.

    2) You can dissect a working PHP webmail application to see how others have done it: www.squirrelmail.org etc

    3) You can make use of commandline programs to do the dirty work: reformime etc.

    Personally, I've had good results using reformime.

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.biz
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    ------------------------------------------
    Search the list archives before you post
    http://marc.theaimsgroup.com/?l=php-general
    ------------------------------------------
    /*
    "Little prigs and three-quarter madmen may have the conceit that the laws of 
    nature are constantly broken for their sakes."
    -- Friedrich Nietzsche
    */
    

    attached mail follows:


    hi thanks for advices I haven't ever heard about reformime, what is it? brtek

    ----- Original Message ----- From: "Jason Wong" <php-generalgremlins.biz> Newsgroups: php.general To: <php-generallists.php.net> Sent: Saturday, February 01, 2003 4:40 PM Subject: Re: [PHP] reading attachmentsl

    > On Saturday 01 February 2003 23:21, Bartosz Matosiuk wrote: > > > well actually I know what is the mechanism of sending mime messages > > with atttachments works, the problem is that I don't know how to to read > > attachment. I tried to use Pear decode functions but it only gives me info > > that there are attachments in the message which is obviosly not enough. > > > > so I'm putting my question once again: how to read attachment from the > > mime message and how to save it on client hard drive??? > > 1) You can see whether the functions in "IMAP, POP3 and NNTP functions" are of > any use. > > 2) You can dissect a working PHP webmail application to see how others have > done it: www.squirrelmail.org etc > > 3) You can make use of commandline programs to do the dirty work: reformime > etc. > > Personally, I've had good results using reformime. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > ------------------------------------------ > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > ------------------------------------------ > /* > "Little prigs and three-quarter madmen may have the conceit that the laws of > nature are constantly broken for their sakes." > -- Friedrich Nietzsche > */ >

    attached mail follows:


    "Durwood Gafford" <durwoodspeakeasy.net> wrote in message news:20030130181906.21395.qmailpb1.pair.com...

    > To make the issues more clear (assuming everyone's not totally burned out > thinking about this one), I will submit links to working, example code in a > followup post. I'm swamped with a proposal i'm working on for my 'day' job, > however -- so stay tuned.

    you can go to http://www.berzerker.net/durwood/phptest and see 3 samples of a simple directory traversal php script ... this is, in essence, the problem i'm facing. Read the readme.txt file there for more info .. but basically there are 2 solutions that work but aren't optimal ... and one that don't work. and i couldn't figure out how to do the "image" version -- it's explained in teh readme file.

    so if anyone can come up with a better solution, let me know!

    thx, durwood

    attached mail follows:


    Hi,

    I am new to PHP and I am writing a script that evaluates input from a form then calls other PHP scripts depending on the input it receives.

    The login form is very simple and asks the user to enter a username and a password. It is used by two types of users, students and supervisors. In the PHP script I check to see what the value is for the username. If it equals "student" I need to call a script that displays the information for the correct student. Else a different script is called that allows the supervisor to select a particular student.

    I am not sure how I can call these scripts to run from inside my current script.

    I know that PHP includes can be used to display code from another script in the current page but I need to call the scripts to run and the content displayed in a separate new page.

    Any advice much appreciated!

    Thank you

    Jason Howlett

    _________________________________________________________________ Stay in touch with MSN Messenger http://messenger.msn.co.uk

    attached mail follows:


    Hi Jason,

    <?php switch ($_REQUEST['username']) { case 'student' : include('student_script.php'); break; case 'supervisor' : include('supervisor_script.php'); break; } ?>

    Better is to use $_POST if your form's method="post" or $_GET if your form's method="get"

    As long as the user type is available to the new page through a form variable, or request string like newpage.php?username=student, you can access it using $_REQUEST/$_GET/$_POST

    Take care, Greg

    --
    phpDocumentor
    http://www.phpdoc.org
    

    "Jason Howlett" <jthowlett1hotmail.com> wrote in message news:F10RmuOE5thPZJCqJHY00007992hotmail.com... > Hi, > > I am new to PHP and I am writing a script that evaluates input from a form > then calls other PHP scripts depending on the input it receives. > > The login form is very simple and asks the user to enter a username and a > password. It is used by two types of users, students and supervisors. In the > PHP script I check to see what the value is for the username. If it equals > "student" I need to call a script that displays the information for the > correct student. Else a different script is called that allows the > supervisor to select a particular student. > > I am not sure how I can call these scripts to run from inside my current > script. > > I know that PHP includes can be used to display code from another script in > the current page but I need to call the scripts to run and the content > displayed in a separate new page. > > Any advice much appreciated! > > > Thank you > > > Jason Howlett > > > > _________________________________________________________________ > Stay in touch with MSN Messenger http://messenger.msn.co.uk >

    attached mail follows:


    it isnt that hard to do.. if you can get "student" and "supervisor" to successfully log into the web pages (even if you dont have anything to display) then all you really need to do is this: suppose that you had $user for username in the form and $password in the form for password... do this: /*after all of the sql login/query is done and checking user names do this:*/ if($user=="student"){ include("scriptname.php"); }elseif($user=="supervisor"){ include("scriptname.php"); }else{ print"an error message here"; } /*end*/ dont know if this would help i would need to see your actual login page and the script that drives the login sequence before i could really tell what to do for it..it all depends on how you have it set up..and are you getting usernames from a sql table or is it hard coded into the login script??

    let me know and mail me private off list at aborkawellstonmichigan.com if you want help...

    laters

    ----- Original Message ----- From: "Jason Howlett" <jthowlett1hotmail.com> To: <php-generallists.php.net> Sent: Saturday, February 01, 2003 10:45 AM Subject: [PHP] Calling other php scripts from inside a php script.

    > Hi, > > I am new to PHP and I am writing a script that evaluates input from a form > then calls other PHP scripts depending on the input it receives. > > The login form is very simple and asks the user to enter a username and a > password. It is used by two types of users, students and supervisors. In the > PHP script I check to see what the value is for the username. If it equals > "student" I need to call a script that displays the information for the > correct student. Else a different script is called that allows the > supervisor to select a particular student. > > I am not sure how I can call these scripts to run from inside my current > script. > > I know that PHP includes can be used to display code from another script in > the current page but I need to call the scripts to run and the content > displayed in a separate new page. > > Any advice much appreciated! > > > Thank you > > > Jason Howlett > > > > _________________________________________________________________ > Stay in touch with MSN Messenger http://messenger.msn.co.uk > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
    

    attached mail follows:


    Hi guys, I have a script which looks in a directory, pulls out all the files and sorts them by reverse date order. The file name schema is "yyyymmdd-the rest of the file".

    Script:

    ---
    $interestingFile = array();
    

    $interestingFiles = array();

    $dir = opendir('/home/danceportal/www/uk/ian') or die( "Could not open dir" );

    while($dirEntry = readdir($dir)){

    if(ereg("summary", $dirEntry) || ereg("full", $dirEntry)){

    array_push($interestingFile, $dirEntry);

    $date = explode("-", $dirEntry);

    $finished = explode(".", $date[0]);

    array_push( $interestingFiles, $finished[0]);

    }

    } sort($interestingFile, SORT_REGULAR); $count = count($interestingFile); $k = $count; $j = "0"; while($j < $count) { $k --; include $interestingFile[$k]; echo "<p>";

    $j ++; } --- What I want to do is get today's date, then check each line against the date and only show the rest of the files with the next one to expire and so on.

    Could someone help me with this please?

    Cheers, Ian.

    attached mail follows:


    A co-worker is teaching me to move to the next level in php. I have started using associative arrays for my scripts, but I am having a problem using them to do an insert into MySQL. Can someone give me an example of how to do an insert to the database using these arrays? My array is this...$item['itemID']

    Thanks Chris

    attached mail follows:


    Yes Chris,

    When you add the item to the database, make sure to leave out the single quotes inside the brackets of the associative array. For example:

    Instead Of: $item['itemID']

    Do This: $item[itemID]

    Example Query: $query = "SELECT * FROM items WHERE '$item[itemID]';

    Hope that helps.

    > -----Original Message----- > From: CDitty [mailto:mailredhotsweeps.com] > Sent: Saturday, February 01, 2003 10:26 AM > To: php-generallists.php.net > Subject: [PHP] MySQL/PHP Associative Array Insert > > > A co-worker is teaching me to move to the next level in php. I have > started using associative arrays for my scripts, but I am having a problem > using them to do an insert into MySQL. Can someone give me an example of > how to do an insert to the database using these arrays? My array is > this...$item['itemID'] > > Thanks > Chris > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    Oops, I forgot the double quotes at the end of the example query from the last email. This is how it should be:

    Example Query: $query = "SELECT * FROM items WHERE '$item[itemID]'";

    > -----Original Message----- > From: Nilaab [mailto:superbus22attbi.com] > Sent: Saturday, February 01, 2003 1:00 PM > To: php-generallists.php.net > Subject: RE: [PHP] MySQL/PHP Associative Array Insert > > > Yes Chris, > > When you add the item to the database, make sure to leave out the single > quotes inside the brackets of the associative array. For example: > > Instead Of: > $item['itemID'] > > Do This: > $item[itemID] > > Example Query: > $query = "SELECT * FROM items WHERE '$item[itemID]'; > > Hope that helps. > > > -----Original Message----- > > From: CDitty [mailto:mailredhotsweeps.com] > > Sent: Saturday, February 01, 2003 10:26 AM > > To: php-generallists.php.net > > Subject: [PHP] MySQL/PHP Associative Array Insert > > > > > > A co-worker is teaching me to move to the next level in php. I have > > started using associative arrays for my scripts, but I am > having a problem > > using them to do an insert into MySQL. Can someone give me an example of > > how to do an insert to the database using these arrays? My array is > > this...$item['itemID'] > > > > Thanks > > Chris > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    On Sat, 01 Feb 2003 10:26:10 -0600 mailredhotsweeps.com (Cditty) wrote:

    > A co-worker is teaching me to move to the next level in php. I have > started using associative arrays for my scripts, but I am having a problem > using them to do an insert into MySQL. Can someone give me an example of > how to do an insert to the database using these arrays? My array is > this...$item['itemID']

    try something like that:

    <other-code ... i.e. connecting and so on> mysql_query("INSERT INTO items SET itemcolumn='".$item['itemID']."'");

    or just

    mysql_query("INSERT INTO items (itemcolumn) VALUES('".$item['itemID']."')");

    Regards,

    -- 
    Thomas Seifert
    

    mailto:thomas.seifertmyphorum.de http://www.MyPhorum.de

    attached mail follows:


    On a slight side note to this, how can you pass javascript variables to PHP via POST?

    Newbie Powell

    On Saturday, February 1, 2003, at 12:21 PM, php-general-digest-helplists.php.net wrote:

    > From: "Sean Malloy" <seanelement.net.au> > Date: Sat Feb 1, 2003 6:48:26 AM Europe/London > To: "Dade Register" <dade49yahoo.com>, <php-generallists.php.net> > Subject: RE: [PHP] Screen Size detect?? > > > Create index.htm; > > <script language="JavaScript"> > var width = screen.width; > var height = screen.height; > window.location = 'index.php?width=' + width + '&height=' + height; > </script> > > and in index.php > > $width = $_GET['width']; > $height = $_GET['height']; > > > etc etc

    attached mail follows:


    index.htm <script language="JavaScript"> function SubmitForm { document.myform.var.value = javascriptvalue; document.myform.submit(); } </script> <body onLoad='SubmitForm();'> <form name='myform' action='index.php' method='post'> <input type='hidden' name='var' value=''> </form> </body>

    or something. I don't even know if that code works... I haven't tested it. but that could be the basis for somehting....

    -----Original Message----- From: Nigel Powell [mailto:guchthatdog.demon.co.uk] Sent: Sunday, 2 February 2003 3:25 AM To: php-generallists.php.net Subject: RE: [PHP] Screen Size detect??

    On a slight side note to this, how can you pass javascript variables to PHP via POST?

    Newbie Powell

    On Saturday, February 1, 2003, at 12:21 PM, php-general-digest-helplists.php.net wrote:

    > From: "Sean Malloy" <seanelement.net.au> > Date: Sat Feb 1, 2003 6:48:26 AM Europe/London > To: "Dade Register" <dade49yahoo.com>, <php-generallists.php.net> > Subject: RE: [PHP] Screen Size detect?? > > > Create index.htm; > > <script language="JavaScript"> > var width = screen.width; > var height = screen.height; > window.location = 'index.php?width=' + width + '&height=' + height; > </script> > > and in index.php > > $width = $_GET['width']; > $height = $_GET['height']; > > > etc etc

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

    attached mail follows:


    I am attempting to populate form elements from a text file which has been read and split into arrays. Some of the items are repeated many times: grade level, for example. Is there a way of just selecting unique values so that each value is displayed only once in the check boxes or radio buttons?

    Many thanks

    Peter Gumbrell

    peterorillia.net

    attached mail follows:


    In a message dated 2/1/2003 9:39:55 AM Pacific Standard Time, peterorillia.net writes:

    >I am attempting to populate form elements from a text file which has been >read and split into arrays. Some of the items are repeated many times: grade >level, for example. Is there a way of just selecting unique values so that >each value is displayed only once in the check boxes or radio buttons?

    Take a look at the function array_unique() which removes duplicate values from an array. Perhaps this function can help you.

    Janet

    ---------------------- Janet Valade Author, PHP & MySQL for Dummies

    attached mail follows:


    Hi,

    The topic says it all: How do you connect to oracle 9i as the user SYS?

    In the user comments about OCILogon() someone mentions that this is a little problematic with 9i, but doesn't really spell out the solution.

    Regards, Lukas Smith smithbackendmedia.com _______________________________ BackendMedia www.backendmedia.com berlinbackendmedia.com

    Linn Zwoch Smith GbR Reuchlinstr. 10-11 Raum 4.1.6 D-10553 Berlin (Tiergarten) Tel +49 30 83 22 50 00 Fax +49 30 83 22 50 07

    attached mail follows:


    I tried but I can't upload any file. My form and code are as following: ------------------------------------ <FORM METHOD="post"> <TABLE> <TR> <TD>File:</TD><TD> <INPUT TYPE="file" SIZE="50" NAME="userfile"></TD> </TR> <TR> <TD>&nbsp;</TD><TD><INPUT TYPE="submit" NAME="Submit" VALUE="OK"><INPUT TYPE="submit" NAME="Abort" VALUE="Abort"></TD> </TR> </TABLE> </FORM>

    <SCRIPT LANGUAGE="php"> if (isset($_POST["Submit"])){ echo "name: ".$_FILES["userfile"]["name"]."<BR>"; echo "size: ".$_FILES["userfile"]["size"]."<BR>"; echo "tmpname: ".$_FILES["userfile"]["tmpname"]."<BR>"; echo "error: ".$_FILES["userfile"]["error"]."<BR>"; } -------------------------------- Now, whenever I try to upload a file, I get such output:

    Notice: Undefined index: userfile in c:\_www\bpm\admintools\downloads.php

    So I've no idea what's up.

    file_uploads: On upload_tpm_dir points to existing directory upload_max_filesize: 2M max_post_size: 8M

    Please help how to make it working. It's PHP 4.3 with Apache/1.3.24 on WinXP Pro

    attached mail follows:


    On Saturday, February 1, 2003, at 10:58 AM, Tomator wrote:

    > I tried but I can't upload any file. My form and code are as following: >

    Try looking at: http://www.php.net/manual/en/features.file-upload.php There is a working example there.

    attached mail follows:


    Hi,

    that's a negative

    They say that after uploading the file, the temp file on the tmp directory (usual) is deleted, anyway in order to confirm the deletion we should use unlink() function.

    Reading from one of the books, they say that the temp files are not deleted if a misconfiguration is found on php.ini or if the directory permissions aren't set as they should be.

    Miguel "Jason Wong" <php-generalgremlins.biz> escreveu na mensagem news:200302010813.52941.php-generalgremlins.biz... > On Saturday 01 February 2003 03:23, Miguel Brás wrote: > > Hey, thx for your speech > > > > In a matter of fact, I have 2 books about PHP and all they say about the > > unlink function (I use it in my upload system) is that it is suposed to > > force the delete of the temporary file that it is created during the upload > > process. > > > > So, i was never thinking that the unlink fuction was able to do it. > > Could you tell us which books they are? They seem to be giving very poor > advice. Uploaded files are _automatically_ deleted when the script ends. > There is no need to force deletion of those temporary files. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > ------------------------------------------ > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > ------------------------------------------ > /* > The best laid plans of mice and men are held up in the legal department. > */ >

    attached mail follows:


    Hello Everyone,

    I've been working on a small pet project of mine. It involves link management for my site. I want to be able to tell the program how many links to display from each of my link files. The program is then to go to that individual link file, randomly pick out how ever many links I've told it to get and then display a description of each link. The description is to be hyperlinked to the actual URL of that link.

    I have a directory that contains 5 text files. Those 5 files each contain 10 links. Each line in a file has two elements. The first being a url, the second being a description. The two elements are delimited by a comma. Here is what they would look like: http://www.File1.com/Link1,File 1 Link 1 http://www.File1.com/Link2,File 1 Link 2 http://www.File1.com/Link3,File 1 Link 3

    My php code is actually two programs. The first program asks for my input. Basically it's a list of the file names with a text box next to each. In that text box I can choose how many links to display from each file. So let's say I choose to display 2 links from the first file, 0 links form the second file, 3 links from the third file, 0 links from the 4th file and 5 links from the fifth file. The program then writes the following to a simple text file: 2 0 3 0 5

    The second program does all of the fun stuff. The first step being to open that text file and read the values: //open result file and read admin count into array $filepointer = fopen ($filename, "r"); $array_admin_count = file ($filename); fclose ($filepointer);

    The next step then opens the directory which contains the 5 files of links and reads each file name: //open directory and read file names $open = opendir ($dir); while ($files = readdir ($open)) { if ($files != "." && $files != "..") { $filesnames = $dir.$files; $array_of_files[] = $filesnames; } } closedir ($open);

    The final part is pretty beefy. This is where my problem is. This part is to open the individual link files, generate the proper amount of random links and then display the description which is hyperlinked to the url. It works if you only choose to display either 0 links from a file or 1 link from a file. If you choose anything over 1 random link, it displays the proper information, but it's mashed together. Here is the code for the final section of part two: //open files and grab random links for ($counter = 0; $counter < count($array_admin_count); $counter++) { $array_admin_count[$counter] = rtrim($array_admin_count[$counter]);

    if ($array_admin_count[$counter] > 0) { //Initialize: $res_string = ''; $res = array(); //expose url's in file $fileopen = fopen ($array_of_files[$counter], "r"); $array_of_links = file ($array_of_files[$counter]); fclose ($fileopen); //choose $number random lines from file $keys = array_rand($array_of_links,$array_admin_count[$counter]); //store random lines into $res array if(is_array($keys)) { foreach($keys as $key) { $res[] = $array_of_links[$key]; } }else{ $res[] = $array_of_links[$keys]; } //if randomize is on, randomize result array if($randomize_results==1) { shuffle($res); } //convert result array to string $res_string = implode("",$res); $getlink = explode(",", $res_string); print ("<a href='$getlink[0]'>$getlink[1]</a><br>");

    Here's what I can figure out: Choosing 0 random links works for obvious reasons. Choosing to display 1 random link works because the array $res will look like this: http://www.File1.com/Link1,File 1 Link 1 The program then creates $res_string. Then the program explodes $res_string based on the comma delimiter into the array $getlink. Then the program displays the two elements of $getlink in the proper manner.

    If you choose to display more then 1 random link the program gets buggy. Let's say you choose to display 2 random links. When the program gets down to the $res array, the value of $res is: http://www.File1.com/Link1,File 1 Link 1 http://www.File1.com/Link2,File 1 Link 2

    Once this happens, the next few lines of code $res_string (by implode) and the $getlink (by explode) creates havoc. I've been up all night trying to figure out a solution. I can't seem to arrive at one. Might any of you have any idea what I can do to resolve this array issue?

    Sorry this email is so long and my description is probably confusing.

    Thanks in advance, Roger

    PS if you wish to see the problem first hand, go here, and choose 1 link from each file. Then go back to it and choose more then 1 and see what happens: http://www.g-i-w-s.com/php/test31.php

    attached mail follows:


    Hi,

    Is there a way to pass a variable to a PHP script without using a form? I want to put several links on my main page that when clicked on goes to a PHP script - depending on what link was selected, will determine what part of the PHP script gets executed.

    TIA, Beauford

    attached mail follows:


    On Sat, 1 Feb 2003, Beauford.2002 wrote:

    > Hi, > > Is there a way to pass a variable to a PHP script without using a form? I > want to put several links on my main page that when clicked on goes to a PHP > script - depending on what link was selected, will determine what part of > the PHP script gets executed.

    Yes, use GET:

    <a href="foo.php?fruit=apple">eat an apple</a>

    See also if() and switch()

    http://www.php.net/else http://www.php.net/switch http://www.php.net/variables.external

    print $_GET['fruit'];

    Regards, Philip

    attached mail follows:


    I have a text file which is read into an array $data using fgets(). The data is then split into further arrays by tab delimiter. I would like to find a way of extracting and printing items from $data using a form. The form fields (e.g. grade, subject) are populated from the arrays. When the user selects a subject and grade, then clicks the button, I would like to select and print only the data, in this case from the array $expect, where the grade is $grade_selected and the subject is $subject_selected. I would appreciate help with how to select and print the relevant data.

    Many thanks,

    Peter Gumbrell peterorillia.net

    attached mail follows:


    Hi,   I've got a html form where not all fields need to be filled by the users. How can I build a MySQL query based on which fields the user have filled?   My guess is that I can do something like this:   if(!empty($f_name)) { some_commands_to_add_$f_name_to_querystring } if(!empty($l_name)) { some_commands_to_add_$f_name_to_querystring } some_commands_to_build_querystring_based_on_if's   $result = mysql_query($query)     But what commands/functions should I use to build the query?

    -- 
    anders thoresson
    

    attached mail follows:


    Dear Sirs,

    I am studying on php. And the book say, when the server see php extension it is running php file and giving results to the visiting browser.

    But as I see related directories are normal directory, doesn' t like cgi-bin directories.

    Is there any change to see php file source such as file open function or something else? I am not going to somebody else file. Just I want to be sure how secure the php?

    Any experience?

    Best Regards

    attached mail follows:


    > I am studying on php. And the book say, when the server see php extension it > is running php file and giving results to the visiting browser. > > But as I see related directories are normal directory, doesn' t like cgi-bin > directories. > > Is there any change to see php file source such as file open function or > something else? I am not going to somebody else file. Just I want to be sure > how secure the php?

    It's all in CVS, read the source:

    http://cvs.php.net/ http://www.php.net/anoncvs.php

    You may also search the source in lxr:

    http://lxr.php.net/

    Also, the following may be helpful to you:

    http://www.zend.com/phpfunc/

    Regards, Philip

    attached mail follows:


    At 21:36 1-2-2003, you wrote: > > I am studying on php. And the book say, when the server see php > extension it > > is running php file and giving results to the visiting browser. > > > > But as I see related directories are normal directory, doesn' t like > cgi-bin > > directories. > > > > Is there any change to see php file source such as file open function or > > something else? I am not going to somebody else file. Just I want to be > sure > > how secure the php? > >It's all in CVS, read the source:

    I think he does not mean the PHP program source, but his scripts' source.

    Normally people cannot see the script source, as long as you use .php as file extension. In some PHP/server setups people can see the source when they type filename.phps, see the installation instruction file in the php package for details.

    attached mail follows:


    hi..

    this is what i want to do but dont realy know how to do it...

    i want to set up a form that will load values from a table and make them the "value" of the edit box... then when people press an update button then all of the stuff that changes from the record already in the table gets changed... anybody know how to make it where you can get the values out of a table and make them the default value of a input field...?

    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
    

    attached mail follows:


    In a message dated 2/1/2003 12:52:24 PM Pacific Standard Time, rusty_81msn.com writes:

    >i want to set up a form that will load values from a table and make them the >"value" of the edit box... then when people press an update button then all >of the stuff that changes from the record already in the table gets >changed... anybody know how to make it where you can get the values out of a >table and make them the default value of a input field...?

    Basically, get your field values from the database and put them in variables. Then use the variables in your form. For instance,

    echo "<input type='text' name='first_name' value='$first_name'>";

    Then, in the script that processes the form, update the database record with the values that were passed from the form.

    Janet

    attached mail follows:


    i tried getting the values into vars using fetch_array/fetch_object and fetch_row and tried to put them in variables but for some odd reason it really doesnt work because when i try to use the vars in the value section instead of printing in the edit box the content of the variable i usually end up with "?>", ">", "<?php", or "}?>" instead... any reason this shows up? and when i do: echo "<input type=text name=$name value='$new_var'>"; then on the web page i end up with some thing like this instead of the edit box: ">";;"> }?> any reason for that?

    how would i get the content into vars from the table? guess thats the main problem right now

    ----- Original Message ----- From: <janetvalade.com> To: <php-generallists.php.net> Sent: Saturday, February 01, 2003 4:28 PM Subject: Re: [PHP] using <input> tags with php

    > In a message dated 2/1/2003 12:52:24 PM Pacific Standard Time, > rusty_81msn.com writes: > > >i want to set up a form that will load values from a table and make them the > >"value" of the edit box... then when people press an update button then all > >of the stuff that changes from the record already in the table gets > >changed... anybody know how to make it where you can get the values out of a > >table and make them the default value of a input field...? > > Basically, get your field values from the database and put them in variables. > Then use the variables in your form. For instance, > > echo "<input type='text' name='first_name' value='$first_name'>"; > > Then, in the script that processes the form, update the database record with > the values that were passed from the form. > > Janet > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
    

    attached mail follows:


    In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time, rusty_81msn.com writes:

    >i tried getting the values into vars using fetch_array/fetch_object and >fetch_row and tried to put them in variables but for some odd reason it >really doesnt work because when i try to use the vars in the value section >instead of printing in the edit box the content of the variable i usually >end up with "?>", ">", "<?php", or "}?>" instead... any reason this shows >up? and when i do: >echo "<input type=text name=$name value='$new_var'>"; >then on the web page i end up with some thing like this instead of the edit >box: >">";;"> >}?> >any reason for that?

    It sounds like $name and/or $new_var may be empty. Did you echo the variables before using them in your form to check whether the values from the database are actually in the variables?

    Janet

    attached mail follows:


    if i do this: /*all the mysql login stuff here*/

    $query=mysql_query("select * from members"); while($new=mysql_fetch_array($query)){ echo "$new['company']"; /*so on through the field list*/ } on output all i get is the title with a submit button..otherwise blank..

    same thing with fetch_object()...and i have 1 row in the members table..im sort of confused now that it doesnt work for a wierd reason

    any better ideas on how to get the stuff out of the table and into vars? maybe im doing it wrong

    ----- Original Message ----- From: <janetvalade.com> To: <php-generallists.php.net> Sent: Saturday, February 01, 2003 5:33 PM Subject: Re: [PHP] using <input> tags with php

    > In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time, > rusty_81msn.com writes: > > >i tried getting the values into vars using fetch_array/fetch_object and > >fetch_row and tried to put them in variables but for some odd reason it > >really doesnt work because when i try to use the vars in the value section > >instead of printing in the edit box the content of the variable i usually > >end up with "?>", ">", "<?php", or "}?>" instead... any reason this shows > >up? and when i do: > >echo "<input type=text name=$name value='$new_var'>"; > >then on the web page i end up with some thing like this instead of the edit > >box: > >">";;"> > >}?> > >any reason for that? > > It sounds like $name and/or $new_var may be empty. Did you echo the variables > before using them in your form to check whether the values from the database > are actually in the variables? > > Janet > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
    

    attached mail follows:


    Hey all.

    In cold fusion I was able to define a default value with the <cfparam name = "test" default = "myValue"> tag

    When I passed the variable "test" via a form or query string, it would over ride the parameter value.

    How can I do this in PHP? I looked in PHP manual for param, default, etc., but could find no equivalent.

    Any ideas?

    --Noah

    --
    

    attached mail follows:


    On Sat, 1 Feb 2003, CF High wrote:

    > Hey all. > > In cold fusion I was able to define a default value with the <cfparam name = > "test" default = "myValue"> tag > > When I passed the variable "test" via a form or query string, it would over > ride the parameter value. > > How can I do this in PHP? I looked in PHP manual for param, default, etc., > but could find no equivalent. > > Any ideas?

    if (!isset($_REQUEST['rvar']) || inappropriate($_REQUEST['rvar'])) { $rvar = 'default'; } else { $rvar = $_REQUEST['rvar']; }

    attached mail follows:


    to set default vale for $id you may use something like :

    $id = !empty($_GET["id"])?$_GET["id"]:null;

    Cf High wrote: > Hey all. > > In cold fusion I was able to define a default value with the <cfparam name = > "test" default = "myValue"> tag > > When I passed the variable "test" via a form or query string, it would over > ride the parameter value. > > How can I do this in PHP? I looked in PHP manual for param, default, etc., > but could find no equivalent. > > Any ideas? > > --Noah > > -- > > >

    -- 
    

    --------------------------- Peio Popov - peiocilaw.org icq# 117130734 http://www.cilaw.org

    attached mail follows:


    Nice Phil.

    A little more typing than the CF version, but the more I delve into PHP, the more I realize its power and flexibility.

    Thanks for the speedy reply...........

    --Noah

    ----- Original Message ----- From: "Philip Olson" <philipcornado.com> To: "CF High" <noahnewminddesign.com> Cc: <php-generallists.php.net> Sent: Saturday, February 01, 2003 1:05 PM Subject: Re: [PHP] Need to set default parameter || How to do in PHP?

    > On Sat, 1 Feb 2003, CF High wrote: > > > Hey all. > > > > In cold fusion I was able to define a default value with the <cfparam name = > > "test" default = "myValue"> tag > > > > When I passed the variable "test" via a form or query string, it would over > > ride the parameter value. > > > > How can I do this in PHP? I looked in PHP manual for param, default, etc., > > but could find no equivalent. > > > > Any ideas? > > if (!isset($_REQUEST['rvar']) || inappropriate($_REQUEST['rvar'])) { > $rvar = 'default'; > } else { > $rvar = $_REQUEST['rvar']; > } >

    attached mail follows:


    I'm trying to install PHP for my first time on a W2000 Server with IIS 5.0, I followed all instructions twice. I added on App Mappings the extension for PHP, etc. etc but always that I try to reach my PHP file I get only a blank page. FAQs say there's some problem with the Web Server and that I have to check, I did but I can find any wrong, then I'm stuck at the beggining. Anyone can help me?

    Thanks

    Fernando Cruz

    Canada

    --------------------------------- Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now

    attached mail follows:


    The following code is supposed to migrate data from an old database to a new one, but produces the error:

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\...\convertdb.php on line 17

    The code:

    <?php

    /* connect to database */ if(!($srcDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('temp', $srcDB)) { echo 'Unable to connect to source database'; exit; }

    if(!($desDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('cgu', $desDB)) { echo 'Unable to connect to destination database'; exit; }

    /* table 'user' */ mysql_query("TRUNCATE TABLE user"); $result = mysql_query("SELECT name, username, password, email, aim, phone, FROM_UNIXTIME(active) FROM user LIMIT 10", $srcDB); while(list($name, $username, $password, $email, $aim, $phone, $active) = mysql_fetch_array($result)) { $fname = substr($name, 0, strrpos($name, ' ')); $lname = substr($name, strrpos($name, ' ')); $password = mysql_result(mysql_query("SELECT DECODE(password, '$username') AS pwd FROM user WHERE username = '$username'", $srcDB), 0, 'pwd'); $signup = mysql_query("SELECT MIN(date) AS signup FROM entry WHERE seller = '$username' OR buyer = '$username'", $srcDB); if(mysql_num_rows($signup) == 0) $signup = $active; else $signup = mysql_result($signup, 0, 'signup'); $sql = "INSERT INTO user (fname, lname, username, password, email, aim, phone, signup, lastActivity) VALUES ('$fname', '$lname', '$username', '$password', '$email', '$aim', '$phone', '$signup', '$active')"; echo '<p><code>'.str_replace(array("('", " '", "',", "')"), array("('<b>", " '<b>'", "</b>',", "'</b>)"), $sql).'</code></p>'; mysql_query($sql, $desDB); }

    ?>

    Any idea?

    Tim

    attached mail follows:


    On Sat, 1 Feb 2003 13:28:00 -0800 timothybugyahoo.com (Tim Lan) wrote:

    > The following code is supposed to migrate data from an old database to a new > one, but produces the error: > > Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result > resource in C:\...\convertdb.php on line 17 > > The code: > [...]

    > Any idea?

    Yeah, read out mysql_error() after sending the query and before doing fetch... to see what mysql thinks is wrong.

    Regards,

    -- 
    Thomas Seifert
    

    mailto:thomas.seifertmyphorum.de http://www.MyPhorum.de

    attached mail follows:


    and by the way, the query on line 16 (the problematic one) works fine when run directly in MySQL.

    Tim

    "Tim Lan" <timothybugyahoo.com> wrote in message news:20030201212758.94730.qmailpb1.pair.com... The following code is supposed to migrate data from an old database to a new one, but produces the error:

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\...\convertdb.php on line 17

    The code:

    <?php

    /* connect to database */ if(!($srcDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('temp', $srcDB)) { echo 'Unable to connect to source database'; exit; }

    if(!($desDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('cgu', $desDB)) { echo 'Unable to connect to destination database'; exit; }

    /* table 'user' */ mysql_query("TRUNCATE TABLE user"); $result = mysql_query("SELECT name, username, password, email, aim, phone, FROM_UNIXTIME(active) FROM user LIMIT 10", $srcDB); while(list($name, $username, $password, $email, $aim, $phone, $active) = mysql_fetch_array($result)) { $fname = substr($name, 0, strrpos($name, ' ')); $lname = substr($name, strrpos($name, ' ')); $password = mysql_result(mysql_query("SELECT DECODE(password, '$username') AS pwd FROM user WHERE username = '$username'", $srcDB), 0, 'pwd'); $signup = mysql_query("SELECT MIN(date) AS signup FROM entry WHERE seller = '$username' OR buyer = '$username'", $srcDB); if(mysql_num_rows($signup) == 0) $signup = $active; else $signup = mysql_result($signup, 0, 'signup'); $sql = "INSERT INTO user (fname, lname, username, password, email, aim, phone, signup, lastActivity) VALUES ('$fname', '$lname', '$username', '$password', '$email', '$aim', '$phone', '$signup', '$active')"; echo '<p><code>'.str_replace(array("('", " '", "',", "')"), array("('<b>", " '<b>'", "</b>',", "'</b>)"), $sql).'</code></p>'; mysql_query($sql, $desDB); }

    ?>

    Any idea?

    Tim

    attached mail follows:


    On Sat, 1 Feb 2003 13:28:00 -0800 timothybugyahoo.com (Tim Lan) wrote:

    > The following code is supposed to migrate data from an old database to a new > one, but produces the error: > > Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result > resource in C:\...\convertdb.php on line 17 > > The code: > > <?php > > /* connect to database */ > if(!($srcDB = mysql_pconnect('localhost', 'root')) || > !mysql_select_db('temp', $srcDB)) { > echo 'Unable to connect to source database'; > exit; > } > > if(!($desDB = mysql_pconnect('localhost', 'root')) || > !mysql_select_db('cgu', $desDB)) { > echo 'Unable to connect to destination database'; > exit; > } >

    ah yes and another thing.

    you can't work on two databases with the same connection parameters (host, username,password) to have different connection-ids. PHP only keeps one connection and not two with the same parameters. They are the same connection for php which is expected behaviour there (although I don't like it too).

    Regards,

    -- 
    Thomas Seifert
    

    mailto:thomas.seifertmyphorum.de http://www.MyPhorum.de

    attached mail follows:


    Thomas,

    I changed it so that the two connections use different username/password combination, and everything went smoothly.

    Thank you very much for your rapid response.

    Tim

    "Thomas Seifert" <thomas.seifertmyphorum.de> wrote in message news:20030201224445.77ff37c3.thomas.seifertmyphorum.de... On Sat, 1 Feb 2003 13:28:00 -0800 timothybugyahoo.com (Tim Lan) wrote:

    > The following code is supposed to migrate data from an old database to a new > one, but produces the error: > > Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result > resource in C:\...\convertdb.php on line 17 > > The code: > > <?php > > /* connect to database */ > if(!($srcDB = mysql_pconnect('localhost', 'root')) || > !mysql_select_db('temp', $srcDB)) { > echo 'Unable to connect to source database'; > exit; > } > > if(!($desDB = mysql_pconnect('localhost', 'root')) || > !mysql_select_db('cgu', $desDB)) { > echo 'Unable to connect to destination database'; > exit; > } >

    ah yes and another thing.

    you can't work on two databases with the same connection parameters (host, username,password) to have different connection-ids. PHP only keeps one connection and not two with the same parameters. They are the same connection for php which is expected behaviour there (although I don't like it too).

    Regards,

    --
    Thomas Seifert
    

    mailto:thomas.seifertmyphorum.de http://www.MyPhorum.de

    attached mail follows:


    $stuffArray[$i][value] = strtr($stuffArray[$i][value], array_flip(get_html_translation_table(HTML_ENTITIES)));

    To be bluntly honest, I don't understand hardly any of it, and the PHP Manual isn't helping this time.. maybe I'm weekend-stupid or something.. *sigh*

    Phil

    attached mail follows:


    > $stuffArray[$i][value] = strtr($stuffArray[$i][value], > array_flip(get_html_translation_table(HTML_ENTITIES))); > > To be bluntly honest, I don't understand hardly any of it, and the PHP > Manual isn't helping this time.. maybe I'm weekend-stupid or something..

    It converts HTML entities back to their original characters. Where htmlentities() and htmlspecialchars() will take characters like <, >, and & and turn them into &lt;, &gt;, and &amp, the code you have will take those entities and turn them back into <, >, and &.

    It's all explained on the get_html_translation_table() manual page, if you care to read the manual.

    http://www.php.net/manual/en/function.get-html-translation-table.php

    ---John W. Holmes...

    PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

    attached mail follows:


    Sorry for the OT question:

    I'm loading a .csv file into MySQL, done it a million times but for some reason it is scrambling the row order. All the fields are making it in correctly but the order of the rows seems to end up totally random. I've done this a million times and never saw this..

    Any thoughts...

    attached mail follows:


    On 01 Feb 2003 16:47:23 -0500 b-boninicox.net (Brian V Bonini) wrote:

    > Sorry for the OT question: > > I'm loading a .csv file into MySQL, done it a million times but for some > reason it is scrambling the row order. All the fields are making it in > correctly but the order of the rows seems to end up totally random. I've > done this a million times and never saw this.. > > Any thoughts...

    where do you take a row-order from? and HOW are you uploading it into mysql? if you don't use a "order by"-clause in a select you won't have a really ordered result (only by accident).

    Regards,

    -- 
    Thomas Seifert
    

    mailto:thomas.seifertmyphorum.de http://www.MyPhorum.de

    attached mail follows:


    > I'm loading a .csv file into MySQL, done it a million times but for some > reason it is scrambling the row order. All the fields are making it in > correctly but the order of the rows seems to end up totally random. I've > done this a million times and never saw this..

    So?

    Why does it matter to you what order the rows are in the database, as long as the right data is there? The order is irrelevant.

    ---John W. Holmes...

    PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

    attached mail follows:


    On Sat, 2003-02-01 at 16:47, Thomas Seifert wrote: > > > > I'm loading a .csv file into MySQL, done it a million times but for some > > reason it is scrambling the row order. All the fields are making it in > > correctly but the order of the rows seems to end up totally random. I've > > done this a million times and never saw this.. > > > > Any thoughts... > > where do you take a row-order from? and HOW are you uploading it into mysql? > if you don't use a "order by"-clause in a select you won't have a really > ordered result (only by accident).

    LOAD DATA INFILE 'file.cvs' INTO TABLE table1 FIELDS TERMINATED BY ';';

    the contnts of file .csv look like:

    1;2002-02-01;New Dominion Pictures;Prosecutors - The Gosch Murder Case;Beau Parcells;Dave Stevenson (victim's husband), Lead;yes;yes;yes 2;2002-02-01;Coastal;Prospecting;Zoe Whitaker;Corporate Representative;yes;yes; 3;2002-02-01;Metro Video;Right Spirit Campaign (Binge Drinking PSA), - Richmond, VA;Tom Downs;Jim (Sailor)/Principal;yes;yes; 4;2002-02-01;Metro Video;Right Spirit Campaign (Binge Drinking PSA), - Richmond, VA;Amie Hill;Spokesperson;;; 5;2002-02-01;Metro Video;Unit of Action (U.S. Army);Tim Smith;Col. Mike Daniels (Principal);;yes; 6;2002-02-01;Metro Video;Colonial Williamsburg;Molly Larkin;Mother/Wife;;yes; 7;2002-02-01;Commercial;Barton Ford;Dave Hobbs;Car Salesman;yes;yes; 8;2002-02-01;Commercial;Barton Ford;Jackie Jackson;Customer's Wife;;; 9;2002-02-01;Regent Films;First Lunch;Molly Larkin;Principal;yes;yes; 10;2002-02-01;Skillet Productions (televisio;Welcome Home;Molly Larkin;Principal;yes;yes;

    etc....

    You'd think they would load into the db just like that right? But they do not. They just end up in some random order.

    attached mail follows:


    On Sat, 2003-02-01 at 17:25, John W. Holmes wrote: > > I'm loading a .csv file into MySQL, done it a million times but for > some > > reason it is scrambling the row order. All the fields are making it in > > correctly but the order of the rows seems to end up totally random. > I've > > done this a million times and never saw this.. > > So? > > Why does it matter to you what order the rows are in the database, as > long as the right data is there? The order is irrelevant. >

    Because in this instance I need it to come out in the order it is actually in.

    attached mail follows:


    On 01 Feb 2003 18:06:01 -0500 b-boninicox.net (Brian V Bonini) wrote:

    > On Sat, 2003-02-01 at 16:47, Thomas Seifert wrote: > > > > > > I'm loading a .csv file into MySQL, done it a million times but for some > > > reason it is scrambling the row order. All the fields are making it in > > > correctly but the order of the rows seems to end up totally random. I've > > > done this a million times and never saw this.. > > > > > > Any thoughts... > > > > where do you take a row-order from? and HOW are you uploading it into mysql? > > if you don't use a "order by"-clause in a select you won't have a really > > ordered result (only by accident). > > LOAD DATA INFILE 'file.cvs' INTO TABLE table1 FIELDS TERMINATED BY ';'; > > the contnts of file .csv look like: > > 1;2002-02-01;New Dominion Pictures;Prosecutors - The Gosch Murder > Case;Beau Parcells;Dave Stevenson (victim's husband), Lead;yes;yes;yes > 2;2002-02-01;Coastal;Prospecting;Zoe Whitaker;Corporate > Representative;yes;yes; 3;2002-02-01;Metro Video;Right Spirit Campaign > (Binge Drinking PSA), - Richmond, VA;Tom Downs;Jim > (Sailor)/Principal;yes;yes; > 4;2002-02-01;Metro Video;Right Spirit Campaign (Binge Drinking PSA), - > Richmond, VA;Amie Hill;Spokesperson;;; > 5;2002-02-01;Metro Video;Unit of Action (U.S. Army);Tim Smith;Col. Mike > Daniels (Principal);;yes; > 6;2002-02-01;Metro Video;Colonial Williamsburg;Molly > Larkin;Mother/Wife;;yes; > 7;2002-02-01;Commercial;Barton Ford;Dave Hobbs;Car Salesman;yes;yes; > 8;2002-02-01;Commercial;Barton Ford;Jackie Jackson;Customer's Wife;;; > 9;2002-02-01;Regent Films;First Lunch;Molly Larkin;Principal;yes;yes; > 10;2002-02-01;Skillet Productions (televisio;Welcome Home;Molly > Larkin;Principal;yes;yes; > > > etc.... > > You'd think they would load into the db just like that right? But they > do not. They just end up in some random order. >

    this doesn't have anything to do with php afaik.

    as I said, try: select * from table1 order by <field1> ASC

    replace the <field1> with the field you have the number in (the first field in your csv).

    -- 
    Thomas Seifert
    

    mailto:thomas.seifertmyphorum.de http://www.MyPhorum.de

    attached mail follows:


    I am having trouble doing things with PHP such as use the exec, system, etc. functions. I can't seem to find the correct php.ini to turn safe_mode off. The one file I did find has safe_mode turned off. When I view phpinfo() it shows the global column with safe_mode off, but for the local column, it is on. Is there a local php.ini file for each site? Where would it be?

    I need to call a script to run in the background and I want to be able to use exec() to call it. Is there an alternative way to do this without bothering with the safe_mode value? i'd prefer to leave safe_mode on; but at the same rate, I am the only one with access to the server as it is my dedicated server.

    I am not familiar enough with Linux just yet to know how to give permissions to my sites to use things such as cron which I desperately need to figure out. I know how to add a crontab for a user, etc. But when the cron file runs, I just get a permission denied. I have tried it for both root and the site user. The only thing that does work is me getting an email stating permission denied. So I know my crontab file is correct. As far as permissions, I'm in a cloud. I have no idea what to do to make it work and maintain a secure system.

    Anyone know where some great (free) docs that will show me how to fish around in Linux? I don't need to be hand fed. Just some direction. Thanks!

    --
    Nicole
    

    attached mail follows:


    Hi,

    I have this message coming when calling the page main.php

    Fatal error: Cannot redeclare formatdate() in /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3

    the code related to this message is:

    <? // format MySQL DATETIME value into a more readable string function formatDate($val) { $arr = explode("/", $val); return date("d/m/y", mktime(0,0,0, $arr[1], $arr[2], $arr[0])); } ?>

    I use this code is some other pages and it works well, but here the code is used in page not_main.php whose I included it on main.php using require() function

    Anyone have a tip for it?

    Thx Miguel

    attached mail follows:


    > I have this message coming when calling the page main.php > > Fatal error: Cannot redeclare formatdate() in > /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3 > > the code related to this message is: > > <? > // format MySQL DATETIME value into a more readable string > function formatDate($val) > { > $arr = explode("/", $val); > return date("d/m/y", mktime(0,0,0, $arr[1], $arr[2], $arr[0])); > } > ?> > > I use this code is some other pages and it works well, but here the code > is used in page not_main.php whose I included it on main.php using > require() > function

    Your function is being declared twice, which means that this file is probably being included or required twice. Look through your code...

    ---John W. Holmes...

    PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

    attached mail follows:


    This is a good reason to use include_once and require_once.

    Jason

    On Sat, 2003-02-01 at 15:59, John W. Holmes wrote: > > I have this message coming when calling the page main.php > > > > Fatal error: Cannot redeclare formatdate() in > > /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3 > > > > the code related to this message is: > > > > <? > > // format MySQL DATETIME value into a more readable string > > function formatDate($val) > > { > > $arr = explode("/", $val); > > return date("d/m/y", mktime(0,0,0, $arr[1], $arr[2], $arr[0])); > > } > > ?> > > > > I use this code is some other pages and it works well, but here the > code > > is used in page not_main.php whose I included it on main.php using > > require() > > function > > Your function is being declared twice, which means that this file is > probably being included or required twice. Look through your code... > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    Thx for the help...

    Miguel "Jason Sheets" <jsheetsphp.net> escreveu na mensagem news:1044141567.4059.5.cameldaemon.shadotech.biz... > This is a good reason to use include_once and require_once. > > Jason > > On Sat, 2003-02-01 at 15:59, John W. Holmes wrote: > > > I have this message coming when calling the page main.php > > > > > > Fatal error: Cannot redeclare formatdate() in > > > /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3 > > > > > > the code related to this message is: > > > > > > <? > > > // format MySQL DATETIME value into a more readable string > > > function formatDate($val) > > > { > > > $arr = explode("/", $val); > > > return date("d/m/y", mktime(0,0,0, $arr[1], $arr[2], $arr[0])); > > > } > > > ?> > > > > > > I use this code is some other pages and it works well, but here the > > code > > > is used in page not_main.php whose I included it on main.php using > > > require() > > > function > > > > Your function is being declared twice, which means that this file is > > probably being included or required twice. Look through your code... > > > > ---John W. Holmes... > > > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > > today. http://www.phparch.com/ > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    On Sat, 1 Feb 2003, Sunfire wrote:

    > if i do this: > /*all the mysql login stuff here*/ > > $query=mysql_query("select * from members"); > while($new=mysql_fetch_array($query)){ > echo "$new['company']"; > /*so on through the field list*/ > } > on output all i get is the title with a submit button.. > otherwise blank..

    There is a bug in PHP 4.3.0 regarding the use of arrays in strings. The following gave a parse error before PHP 4.3.0:

    print "Do not do this: $arr['key']";

    Now it gives an E_NOTICE error due to changes to the string scanner. In PHP 4.3.1 it will no longer give a bogus E_NOTICE and instead it will work (no parse error either). Surrounding the array with {braces} in the string works regardless, so:

    print "You can do this: {$arr['key']}";

    Regarding this question, don't write it like that but instead do the following (no quotes needed):

    echo $new['company'];

    For those wondering about this bug, see:

    http://bugs.php.net/bug.php?id=21820

    The string documentation has been updated to demonstrate the array in string phenomena (except the bug hasn't been mentioned as I'm waiting for it to be committed first).

    http://www.php.net/types.string

    Sunfire, you aren't seeing this E_NOTICE error because your error level is turned down (by default). Put this on top of your script to see them all:

    error_reporting(E_ALL);

    Regards, Philip

    > same thing with fetch_object()...and i have 1 row in the members table..im > sort of confused now that it doesnt work for a wierd reason > > any better ideas on how to get the stuff out of the table and into vars? > maybe im doing it wrong > > > ----- Original Message ----- > From: <janetvalade.com> > To: <php-generallists.php.net> > Sent: Saturday, February 01, 2003 5:33 PM > Subject: Re: [PHP] using <input> tags with php > > > > In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time, > > rusty_81msn.com writes: > > > > >i tried getting the values into vars using fetch_array/fetch_object and > > >fetch_row and tried to put them in variables but for some odd reason it > > >really doesnt work because when i try to use the vars in the value > section > > >instead of printing in the edit box the content of the variable i usually > > >end up with "?>", ">", "<?php", or "}?>" instead... any reason this shows > > >up? and when i do: > > >echo "<input type=text name=$name value='$new_var'>"; > > >then on the web page i end up with some thing like this instead of the > edit > > >box: > > >">";;"> > > >}?> > > >any reason for that? > > > > It sounds like $name and/or $new_var may be empty. Did you echo the > variables > > before using them in your form to check whether the values from the > database > > are actually in the variables? > > > > Janet > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    hi.. i took your idea... i put the error reporting code at the top of the script and ran it as the problem was still there to see what would happen.. instead i get 0 messages from the reporting system and all i get is the last 7 chars of the print line and the }?> at the end of the script... so for instance if i do: print("<input type=\"text\" name=\"company\" value=$new['company']\n"); or any variance of that statement changing around the \" and apostrophes around to try different things all i get is the rest of the script starting from the \n all the way to the rest of the script where it says }?> at the end dont know if this is a bug or not but its getting hard to figure out what the problem with my echo or print statements are... here is the whole script: its supposed to get all fields and then display in input text boxes the current values in that certain record i know i missed some stuff in it with the query but at this point was supposed to be a test to see if i could even put it in the box in the first place... but here is the code: <html> <head> <title>edit member</title>

    </head>

    <form action=edit1.php method=post> pick some of these:<br> <?php error_reporting(E_ALL); mysql_connect("192.4.5.6", "root", ""); mysql_select_db("wata"); $result=mysql_query("select * from members where company like 'test'"); while($row=mysql_fetch_array($result)){ print("<input type=text name=company value=\"$row[company\"]>\n\n"); } ?> <input type="submit" value="send"> </form> </html>

    /*end*/ any changes to make it work would be appreciated...tnx

    ----- Original Message ----- From: "Philip Olson" <philipcornado.com> To: "Sunfire" <rusty_81msn.com> Cc: <php-generallists.php.net>; <janetvalade.com> Sent: Saturday, February 01, 2003 6:48 PM Subject: Re: [PHP] using <input> tags with php (IMPORTANT READ)

    > > On Sat, 1 Feb 2003, Sunfire wrote: > > > if i do this: > > /*all the mysql login stuff here*/ > > > > $query=mysql_query("select * from members"); > > while($new=mysql_fetch_array($query)){ > > echo "$new['company']"; > > /*so on through the field list*/ > > } > > on output all i get is the title with a submit button.. > > otherwise blank.. > > There is a bug in PHP 4.3.0 regarding the use of arrays > in strings. The following gave a parse error before > PHP 4.3.0: > > print "Do not do this: $arr['key']"; > > Now it gives an E_NOTICE error due to changes to the string > scanner. In PHP 4.3.1 it will no longer give a bogus E_NOTICE > and instead it will work (no parse error either). Surrounding > the array with {braces} in the string works regardless, so: > > print "You can do this: {$arr['key']}"; > > Regarding this question, don't write it like that but instead > do the following (no quotes needed): > > echo $new['company']; > > For those wondering about this bug, see: > > http://bugs.php.net/bug.php?id=21820 > > The string documentation has been updated to demonstrate > the array in string phenomena (except the bug hasn't been > mentioned as I'm waiting for it to be committed first). > > http://www.php.net/types.string > > Sunfire, you aren't seeing this E_NOTICE error because your > error level is turned down (by default). Put this on top > of your script to see them all: > > error_reporting(E_ALL); > > Regards, > Philip > > > > same thing with fetch_object()...and i have 1 row in the members table..im > > sort of confused now that it doesnt work for a wierd reason > > > > any better ideas on how to get the stuff out of the table and into vars? > > maybe im doing it wrong > > > > > > ----- Original Message ----- > > From: <janetvalade.com> > > To: <php-generallists.php.net> > > Sent: Saturday, February 01, 2003 5:33 PM > > Subject: Re: [PHP] using <input> tags with php > > > > > > > In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time, > > > rusty_81msn.com writes: > > > > > > >i tried getting the values into vars using fetch_array/fetch_object and > > > >fetch_row and tried to put them in variables but for some odd reason it > > > >really doesnt work because when i try to use the vars in the value > > section > > > >instead of printing in the edit box the content of the variable i usually > > > >end up with "?>", ">", "<?php", or "}?>" instead... any reason this shows > > > >up? and when i do: > > > >echo "<input type=text name=$name value='$new_var'>"; > > > >then on the web page i end up with some thing like this instead of the > > edit > > > >box: > > > >">";;"> > > > >}?> > > > >any reason for that? > > > > > > It sounds like $name and/or $new_var may be empty. Did you echo the > > variables > > > before using them in your form to check whether the values from the > > database > > > are actually in the variables? > > > > > > Janet > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > --- > > Outgoing mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003