php-general Digest 19 Sep 2002 11:01:14 -0000 Issue 1594

Topics (messages 116803 through 116856):

How to approach a new project?
        116803 by: Wm

Re: Join in MySQL-select doesn't work
        116804 by: David Robley

mysql_query w/ JOIN results giving unexpected results w/ PHP (not regular SQL though)
        116805 by: Thoenen, Peter  Mr.  EPS

Re: Loop through POST-result
        116806 by: David Robley

how to time an http request
        116807 by: Lee Doolan
        116842 by: Jason Morehouse
        116850 by: Petr Tomenendál

linux install error
        116808 by: :B nerdy

Re: Sessions /Cross Domain
        116809 by: Chris Shiflett

Re: header() and POST
        116810 by: Chris Shiflett
        116843 by: Chris Shiflett

Re: Date-format
        116811 by: Support . Fourthrealm.com

Re: Need some help please.
        116812 by: David Freeman
        116834 by: Simon Angell
        116849 by: David Freeman

use of mysql_free_result (was Re: [PHP] Efficiency)
        116813 by: Support . Fourthrealm.com
        116815 by: Chris Shiflett

Re: COOKIE Question.
        116814 by: Tom Ray

reuse database connections
        116816 by: Support . Fourthrealm.com
        116817 by: Kumar Lakshminarayanan
        116832 by: olinux

include_path? programmatically
        116818 by: Christian Calloway
        116819 by: Matt Wiseman

can you recommend PHP shopping cart
        116820 by: Peter J. Schoenster
        116822 by: olinux
        116831 by: Nicole Lallande

SELECT dropdown from a db query?
        116821 by: Andre Dubuc
        116824 by: Sascha Cunz
        116826 by: Andre Dubuc
        116827 by: Jacob Miller
        116829 by: Andre Dubuc

Re: Auto-increment value
        116823 by: Faisal Abdullah

Weird problem with Windows XP and IE6
        116825 by: Jason
        116828 by: Jason

Re: Friend of function??
        116830 by: Sascha Cunz

Re: numeric to word function
        116833 by: Tom Rogers

Strange submission problem
        116835 by: Jesse Lawrence
        116836 by: Jacob Miller
        116838 by: Jesse Lawrence

inheriting default constructor behavior?
        116837 by: Monique Y. Herman
        116841 by: Jason Morehouse

pardon the previous mis-topic
        116839 by: Monique Y. Herman

compiling a regexp
        116840 by: David T-G

redefining a function
        116844 by: David T-G

Good OO PHP resources? Open Source APIs?
        116845 by: Michael Zornek
        116846 by: Manuel Lemos

New problem - preg_match?
        116847 by: Chad Winger

Unserialize stopped working after php & db upgrade
        116848 by: Geoff Caplan
        116851 by: Martin Towell

Encrypting/Decrypting Data
        116852 by: [-^-!-%-

Simultaneous system(),passthru()... commands. HELP PLEASE !!!
        116853 by: Jean-Marc Godart

parallel connections with php
        116854 by: Jens

Return array from extension
        116855 by: Ole Stakemann

Re: [PHP-DEV] and so... there is a security problem.
        116856 by: Vergoz Michael \(SYSDOOR\)

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
I'm trying to work out the best way to approach a new project, and would
appreciate any suggestions/"beware of"s from the experienced PHPers out
there.  I want to build a project where I can enter data from a gym routine
online and generate graphs of the data.  I'm not familiar with GDLIB, but is
this something that can help generate a graph from mySQL data?  Is this
project feasible/realistic for a new PHP programmer?

Also, any suggestions on the structure of the mySQL database would be
appreciated.  The general data that would need to be input would be:

Date
Group
Exercise1
Ex1Weight
Ex1Reps
Ex2Weight
Ex2Reps
Ex3Weight
Ex3Reps
Exercise2
Ex1Weight
Ex1Reps
Ex2Weight
Ex2Reps
Ex3Weight
Ex3Reps
etc...

Plus several calculations would need to be made, which I could presumably do
with PHP when I extract the data.

Any/all suggestions on how to plan this process would be greatly
appreciated!  I'm hoping to have a sound game plan for beginning this
process.

Thanx!
Wm
luvs2shootAThotmailDOTcom




--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hello
> I'm using PHP4 and MySQL on Apache webserver.
> I have a table valled "liste" with names of some people, and a table 
> called "postnummer" with zip-codes and citynames.
> My select should join the adress and zip from one table with the 
> cityname from the other table.
> But my join-line does not work.   =:(
> 
> My code results in this line:
> 
> Warning: Supplied argument is not a valid MySQL result resource in 
> /var/www/html/find/resultat.php on line 27
> 
> The code is:
> mysql_select_db("adresser");
> $query = ("SELECT fornavn, efternavn, gade, postnummer.postnummer, 
> postnummer.postbynavn FROM liste
> left outer join postnummer on liste.postnummer = postnummer.postnummer
> WHERE MATCH (fornavn, efternavn) AGAINST ('$search');");
> $result = mysql_query($query);

Add here

echo mysql_error();

which will return you an error string from mysql which will probably be an 
error in your query syntax. It might also be useful to echo $query to 
ensure that it contains what you expect it does (possible register_globals 
problem?)

> while(list($cpr, $fornavn, $efternavn, $gade, $postnummer, $postbynavn) =
> mysql_fetch_row($result))
> 
> What is going on?
> The select is ok if I do not join, but then I'm not able to get the 
> field "postbynavn" from the other table.
> 
> PLEASE HELP!


-- 
David Robley
Temporary Kiwi!

Quod subigo farinam
--- End Message ---
--- Begin Message ---
Hello everybody,

Having an issue where I am getting unexpected results with a simple query
and at a lost to explain why.

At the end is my code.  The problem I believe though I have narrowed down to
the following statement.

1.  When I run SELECT accounts.id, accounts.action, people.last,
people.first, people.rank FROM accounts JOIN people WHERE (accounts.account
= people.id OR accounts.id = people.id) AND accounts.status='submitted';
directly into mysql (NOT USING PHP) I get the proper results.  (1 row)

2.  When I run it below using PHP I get unexpected results.  (All 4 rows)

Database looks like:

-----ACCOUNTS-------
ID      ACTION  STATUS  DATE_SUBMITTED  ACCOUNT
1       create  pending NULL                    56
2       modify  pending NULL                    58      
3       new             pending NULL                    65
4       delete  submitted       2002-09-10              89

----PEOPLE----------
ID      LAST    FIRST   RANK
56      A       GUY     NULL
58      B       GUY     NULL
65      C       GUY     NULL
89      D       GUY     NULL

AFTER JOIN STATEMENT SHOULD LOOK LIKE: (when ran directly with mysql
bypassing PHP)

ID      ACTION  LAST    FIRST   RANK
4       delete  D       GUY     NULL

Instead I am getting (when  using below code): (when ran with PHP)
ID      ACTION  LAST    FIRST   RANK
1       create  A       GUY     NULL
2       modify  B       GUY     NULL
3       new             C       GUY     NULL
4       delete  D       GUY     NULL

Debugging:

Have did mysql_num_rows($query); on the JOIN query and it returns 1 so it is
returning the proper number of rows.
Have also added an iterator to the while($row) to verify loop count == row
count.  This also returns 1=1

Yet somehow the 'users' file has ALL 4 entries in it at end of the run.

At a complete loss how this can be so.

Any help on this would be appreciated.

Thanks,

-Peter

##### START CODE ###########

          require_once 'auth.php';
          $date=date("ymd");
          if (isset($submit)){
            foreach ($submit as $value){
              digit($value);
              mysql_query("UPDATE accounts SET status='submitted',
date_submitted='$date' WHERE id=$value;");
            }
          }
          $query=mysql_query("SELECT site, address FROM unit WHERE
name='$unit'");
          $row=mysql_fetch_array($query);
          extract($row);
          $query=mysql_query("SELECT accounts.id, accounts.action,
people.last, people.first, people.rank FROM accounts JOIN people WHERE
(accounts.account = people.id OR accounts.id = people.id) AND
accounts.status='submitted';");
          if (mysql_num_rows($query)>0){
            $fp=fopen('users', 'w');
            while ($row=mysql_fetch_array($query)){
              extract($row);
              $s="MAILBOX";
              $s.="\t$action";
              $s.="\tKFOR\\$last".substr($first,0,1);
              $s.="\t$last".substr($first,0,1);
              $s.="\t$first";
              $s.="\t$last";
              $s.=isset($middle)?"\t$middle":'';
              $s.="\t$rank";
              $s.="\tBONDSTEEL2";
              $s.="\t$last, $first";
              $s.=isset($middle)?"$middle.":'';
              $s.="  $rank";
              $s.=$rank=='CIV'?$unit:'';
              $s.="\t$phone";
              $s.="\t$unit";
              $s.="\t$address, $site";
              $s.="\tYugo";
              $s.="\t09340";
              $s.="\tAE";
              $s.="\tAPO\n";
              fwrite($fp, $s);
            }
            fclose($fp);
            unlink('users');
          }


##################################
Peter Thoenen - Systems Programmer
Commercial Communications
Camp Bondsteel, Kosovo
##################################

"Stumbled Upon"...heh (Score:5, Funny) /.
by $carab on 23:00 23 August 2002 (#4131637)

"ForensicTec officials said they stumbled upon the military networks about
two months ago, while checking on network security for a private-sector
client."

Someone new to a Dvorak probably tried to type in "lynx
http://www.google.com"; but instead got "nmap -v -p 1-1024 -sS -P0 army.mil
-T paranoid".
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> I would like to get all the data from a POST-result into an array.
> 
> Is there a function like that adds all the vars from the post into an array
> where Key is the name of the form-field and Value is the value entered in
> this field.
> 
> Like this:
> array('firstname' => 'fname', 'lastname' => 'lname');
> 
> Thanks,
> // Michelle

each() From the docs:

Example 125. Traversing $_POST with each() 

echo "Values submitted via POST method:<br />\n";
reset ($_POST);
while (list ($key, $val) = each ($_POST)) {
   echo "$key => $val<br />\n";
} 
After each() has executed, the array cursor will be left on the next 
element of the array, or on the last element if it hits the end of the 
array. You have to use reset() if you want to traverse the array again 
using each. 


-- 
David Robley
Temporary Kiwi!

Quod subigo farinam
--- End Message ---
--- Begin Message ---


is there a program which i can run in a unix environment (FreeBSD or
redhat) which can run, say, 100 requests on a url and then report the
total time spent on the requests?  i know that i could run curl or
wget in a loop, but i would have to account for the fork-exec time
somehow.  i hope that the question is clear.


-- 
Flowers of morning glory.      +-----------------------------------------+
The sky above this street      |donate to causes I care about:           |
Begins to overcast.            |  http://svcs.affero.net/rm.php?r=leed_25|
                   --Sugita    +-----------------------------------------+
--- End Message ---
--- Begin Message ---
What's wrong with fopen?

On Wed, 18 Sep 2002 16:12:05 +0000, Lee Doolan wrote:

> 
> 
> is there a program which i can run in a unix environment (FreeBSD or
> redhat) which can run, say, 100 requests on a url and then report the
> total time spent on the requests?  i know that i could run curl or
> wget in a loop, but i would have to account for the fork-exec time
> somehow.  i hope that the question is clear.

-- 
 Jason Morehouse (jm[@]netconcepts[.]com)
 Netconcepts - http://www.netconcepts.com
 Auckland, New Zealand

 Linux: Because rebooting is for adding hardware.

--- End Message ---
--- Begin Message ---
If you want a tool to test HTTP server responses, then i can recommend
Siege. You can specify number of simultaneous requests and 
URL/URLs to be tested. For more info look at: 
http://www.joedog.org/siege/index.shtml

P.


On Thu, 2002-09-19 at 01:12, Lee Doolan wrote:
> 
> 
> is there a program which i can run in a unix environment (FreeBSD or
> redhat) which can run, say, 100 requests on a url and then report the
> total time spent on the requests?  i know that i could run curl or
> wget in a loop, but i would have to account for the fork-exec time
> somehow.  i hope that the question is clear.
> 
> 
> -- 
> Flowers of morning glory.      +-----------------------------------------+
> The sky above this street      |donate to causes I care about:           |
> Begins to overcast.            |  http://svcs.affero.net/rm.php?r=leed_25|
>                    --Sugita    +-----------------------------------------+
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
i got the following error on install.. any ideas?

In file included from /usr/include/math.h:348,
                 from /root/php-4.2.3/main/php_config.h:2107,
                 from my_config.h:5,
                 from global.h:33,
                 from net.c:14:
/usr/include/bits/mathinline.h: In function `pow':
/usr/include/bits/mathinline.h:382: parse error before `0'
make[4]: *** [net.lo] Error 1
make[4]: Leaving directory `/root/php-4.2.3/ext/mysql/libmysql'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/root/php-4.2.3/ext/mysql/libmysql'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/root/php-4.2.3/ext/mysql'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/root/php-4.2.3/ext'
make: *** [install-recursive] Error 1



--- End Message ---
--- Begin Message ---
James's answer is likely what you are looking for. As there are many 
different ways to maintain sessions, you're going to get many different 
answers.

However, the default behavior for PHP sessions is to assign the unique 
identifier to a cookie. If this cookie has a domain of .web.com (see 
James's answer below for how), then Web sites at secure.web.com and 
www.web.com will both be able to read it. Thus, you would need to make 
no adjustments; you will be using the same session. This is not 
cross-domain state management...

The only caveat is the case where you are running these two domains on 
two physically separate machines. If this is the case, the above 
suggestion won't help you without some work. The work in this case would 
be to store your session data in a database, because the default 
behavior is to store it on the filesystem. Since you state, "both web 
sites point to the same set of data," I assume they are either both 
located on the same machine or both have access to a common database, so 
one of these methods will work for you.

Happy hacking.

Chris

James E Hicks III wrote:

>Have a look at this php.ini setting, I think it will help you!
>
>; The domain for which the cookie is valid.
>session.cookie_domain =
>
>-----Original Message-----
>From: David Buerer [mailto:[EMAIL PROTECTED]]
>
>Suppose I have two websites:
>    secure.web.com
>    www.web.com <http://www.web.com>
>

--- End Message ---
--- Begin Message ---
The short answer is no (based on my interpretation of your question).

Consider carefully where you are wanting to send data and when. The 
header() function is specifically for manipulating HTTP headers in the 
response you will send the Web client. You are probably not wanting to 
post data to the client; you want to post data to another Web server, right?

I cannot tell from your question what exactly you are wanting to do, to 
be honest. If you want to automate a post, you should look into the curl 
extension of PHP. If you actually only need to maintain data across 
several pages on your own site, please restate the question.

Happy hacking.

Chris

P.S. You may want to use a proper name in your email client. My guess is 
that "dsfljsdfklj kljvdskljfsdkl" is going to get filtered by some 
people's spam-filtering software.

dsfljsdfklj kljvdskljfsdkl wrote:

>a php page receives POST data from a form, it needs to
>elaborate the data and send it to another page again
>in POST automatically, without the user noticing.
>
>Is it possible to use the header() function to send a
>POST request? If yes how? And how do I send the post
>data?
>

--- End Message ---
--- Begin Message ---
Here is an example of how to manually perform an HTTP POST with PHP. If 
you execute this code, you should see the search results of searching 
the PHP manual for the term "curl" (using language en_US). Curl is 
another option for people who need to do this sort of thing.

Happy hacking.

Chris

<base href="http://www.php.net/";>
<?
function php_post($host, $path, $data)
{
    $http_response="";
    $fp=fsockopen($host, 80);
    fputs($fp, "POST $path HTTP/1.1\r\n");
    fputs($fp, "Host: $host\r\n");
    fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n");
    fputs($fp, "Content-Length: " . strlen($data) . "\r\n");
    fputs($fp, "Connection: close\r\n\r\n");
    fputs($fp, "$data");
    while(!feof($fp))
    {
        $http_response.=fgets($fp, 128);
    }
    fclose($fp);
    list($http_headers, $http_content)=explode("\r\n\r\n", $http_response);
    return $http_content;
}

$content=php_post("www.php.net", "/search.php", 
"lang=en_US&pattern=curl&show=manual");
echo $content;
?>


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

Thanks everyone for the helpful answers.

I agree that manuals are useful, but there are times when an example works 
better.

I took all of this information, and some details from earlier posts about 
dates, and produced the following function to make it easy to format dates 
without have to go through and change sql stmts.

# --- Function to format date output ---
function makedate($format, $indate)
{
         $temp = explode("-", $indate);
         $fulldate = mktime(0, 0, 0, $temp[1], $temp[2], $temp[0]);
         $temp = date($format, $fulldate);
         return ($temp);
}


The function gets called like this:

makedate('Y/m/d', $row->articledate);    or
makedate("F d, Y", $somedate);


Hopefully this will someone else with their date challenges.


Peter


At 02:55 PM 9/18/2002 -0400, Chuck Payne wrote:

>I know everyone love to quote read the manual and forget that we[newbies]
>are only asking here because we need help...so here you go...
>
>You can do the following...
>
>DATE_FORMAT IS THE MySQL Command
>
>And let say you want to format your date as the following mm-dd-yy(US) or
>dd-mm-yy(the rest of the world).
>
>By the way this are format keys....
>
>%m the month in numbers,
>%d the days in numbers,
>%y the year in number
>%M spells out the month
>%D gives the date with th, rd, nd all that
>%Y gives all four numbers
>
>So you do the following sql statement...
>
>SELECT DATE_FORMAT(yourdate, '%m-%d-%y') as youwanttocallit FROM yourtable;
>
>So in your php code you can do this from your MySQL statement...
>
>$youwantcallit = $myrow[youwanttoit];
>
><? echo $youwanttocallit; ?>
>
>Advance note
>
>then if you don't want to show 00-00-00 you can do this...
>
>if ($youwanttocallit == "00-00-00") {
>   $youwanttocallit = "&nbsp;";
>}
>
>that way you don't have a bunch of 00-00-00 showing up.
>
>I hope that helps, because that is what the maillisting is for and not to
>always quote "Read the Book".
>
>Chuck Payne
>Magi Design and Support
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -

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

 > I am having trouble with a PHP script. I am not the one who 
 > made this and my knowledge on php is very little.
 > I came across this php script 
 > www.canberra-wx.com/bomonster/bomonster01.php

Tried loading this and had too many page errors to figure out what you
are doing.

 > www.canberra-wx.com/bomonster/bomonster1.php

Ditto for this one.

 > Any help on how to get it to work would be great.

First comment is a conceptual one rather than a programming one.

I presume you are doing this so that every time someone loads your page
they get current information?  You do know that the BoM only updates
forecasts around three to four times per day don't you?  In this case it
means that every hit on your page is reloading what is, largely, static
information.  You would be far better off caching the raw data on your
own server and using it from there.

Use cron and possibly lynx to grab the raw data that you need on an
appropriate schedule (say every six hours or, alternately, around an
hour after normal release time for each forecast) and either process it
straight away to produce the display information you need or store it
locally to be processed each time the page loads.  Ideally, you'd create
a static version of the page each time you grab new forecast information
and just display it.

Once you have the data on your server you can process it accordingly
which is where the php comes in.  The major hurdle is in pattern
matching and the like to find the relevant bit.

I am currently doing something moderately similar to this on
www.outbackqld.net.au (current conditions in top right corner) and it is
working just fine with an update every hour or so being cached locally.

I'm happy to discuss the issues of doing this further but am not
actually using php for anything but the last step - the rest of the
solution is done using a combination of cron, lynx and grep.

CYA, Dave



--- End Message ---
--- Begin Message ---
Thats a Nice feaure you have, How do you do that?

I have spoken to guy who made the php file and he will look into the bugs
for me, also i will keep playing around with it.

--
Cheers
---------------------------------------------------------
Simon Angell
Canberra ACT
www.canberra-wx.com
---------------------------------------------------------
Member of:
Australian Severe Weather Association.
www.severeweather.asn.au
---------------------------------------------------------
This email is virus free.
Scanned before leaving my mailbox
using Norton Antivirus 2002 for Win2k
Scanned with the latest definition File.

"David Freeman" <[EMAIL PROTECTED]> wrote in message
005101c25f70$4f197700$3f0a0a0a@skink">news:005101c25f70$4f197700$3f0a0a0a@skink...
>
>  > I am having trouble with a PHP script. I am not the one who
>  > made this and my knowledge on php is very little.
>  > I came across this php script
>  > www.canberra-wx.com/bomonster/bomonster01.php
>
> Tried loading this and had too many page errors to figure out what you
> are doing.
>
>  > www.canberra-wx.com/bomonster/bomonster1.php
>
> Ditto for this one.
>
>  > Any help on how to get it to work would be great.
>
> First comment is a conceptual one rather than a programming one.
>
> I presume you are doing this so that every time someone loads your page
> they get current information?  You do know that the BoM only updates
> forecasts around three to four times per day don't you?  In this case it
> means that every hit on your page is reloading what is, largely, static
> information.  You would be far better off caching the raw data on your
> own server and using it from there.
>
> Use cron and possibly lynx to grab the raw data that you need on an
> appropriate schedule (say every six hours or, alternately, around an
> hour after normal release time for each forecast) and either process it
> straight away to produce the display information you need or store it
> locally to be processed each time the page loads.  Ideally, you'd create
> a static version of the page each time you grab new forecast information
> and just display it.
>
> Once you have the data on your server you can process it accordingly
> which is where the php comes in.  The major hurdle is in pattern
> matching and the like to find the relevant bit.
>
> I am currently doing something moderately similar to this on
> www.outbackqld.net.au (current conditions in top right corner) and it is
> working just fine with an update every hour or so being cached locally.
>
> I'm happy to discuss the issues of doing this further but am not
> actually using php for anything but the last step - the rest of the
> solution is done using a combination of cron, lynx and grep.
>
> CYA, Dave
>
>
>


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

 > Thats a Nice feaure you have, How do you do that?

I have a cron event on my server that grabs the relevant page from the
web site soon after it is updated (around 20 past each hour) using "lynx
-dump url" which then pipes the resulting page dump through grep to grab
just the line of data that includes my town and dumps that output to a
file.

The file contains a single line of data that includes all of the
information I display plus some other stuff on the page that I don't
use.

Within my php page I open that small file and load it into an array for
display on the page.

Obviously there's some error checking in there for various fail
conditions and some other stuff too but that's the basics of it.

I've looked at doing something similar for forecasts but as I don't
(yet) have a need to display them I haven't got around to it.

The main advantage of this method is that you're not grabbing the data
on every page load but, instead, only when the data on the source web
site can reasonably be expected to have changed.

<delurk>As well as running a business with my wife I work for the BoM
and have done for about 18 years now</delurk>

CYA, Dave



--- End Message ---
--- Begin Message ---
Rick, or anyone,

Based on what you said below, can you describe for me when the 
mysql_free_result tag should be used, and when it is not necessary?

I'm fluent in other web languages (iHTML, ASP), but am fairly new to PHP, 
so I'm still learning the intricacies of the language, and the best way to 
use it

Many thanks,
Peter



At 04:02 PM 9/18/2002 -0600, you wrote:
>If you aren't doing anything else in a script, mysql_free_result is not needed
>in a script like this because the result set will be cleaned up by PHP when
>the script ends.

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -

--- End Message ---
--- Begin Message ---
This frees the memory that is used to store the results of your query 
(the $result variable in most examples).

Many people leave this out, because PHP does a lot of cleanup for you 
when your script exits. However, it is a good habit to go ahead and free 
your results once you are finished using them. It is never really 
necessary, but imagine if you have an enormous result set that takes a 
great deal of memory, you have many people hitting your site, and you 
have a great deal of logic remaining before your script executes. The 
amount of wasted memory can be significant in some cases, so you can use 
this function to keep the "damage" low.

Happy hacking.

Chris

Support @ Fourthrealm.com wrote:

> Based on what you said below, can you describe for me when the 
> mysql_free_result tag should be used, and when it is not necessary? 


--- End Message ---
--- Begin Message ---
Discovered my cookie issue. I wasn't setting the path in setcookie() so 
it defaulted to what ever directory the script ran in.  I set it so it 
loads from the root of the website now, and it's working like a charm.

Thanks to all that helped!

John Holmes wrote:

>>I do the print $_COOKIE["Acccess]"; and I still don't see any data
>>    
>>
>print.
>
>Did you typo in your code like you did here??
>
>Try to dump the whole $_COOKIE[] array and see what's in it. 
>
>print_r($_COOKIE);
>
>Did you mention what version of PHP you were using?
>
>---John Holmes...
>
>
>  
>

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

Another question about efficiency / using server resources:

In another language I use, I can re-use an ODBC connection to make further 
queries/update/etc to the database to save the overhead of closing and 
reopening the connection to the db over and over.

It works sometime like this (in the other language):
<iSQL DBNAME='xxx' LOGIN='xxx' SQL='some query'>   # opens the connection
         ... display results...
<iSQLMORE SQL='some other query'>  # reuses the connection
         ....display other results....
</iSQL>   # closes the connection


Is there an equivalent in PHP to this, using the mySQL set of tags?


Peter


- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -

--- End Message ---
--- Begin Message ---
You can use persistent connections from php to mysql server
using mysql_pconnect(host,user,passwd) then go on to use the returned link.
this will open a new connection only if one is not available.
kumar

"Support @ Fourthrealm.com" wrote:

> Another question about efficiency / using server resources:
>
> In another language I use, I can re-use an ODBC connection to make further
> queries/update/etc to the database to save the overhead of closing and
> reopening the connection to the db over and over.
>
> It works sometime like this (in the other language):
> <iSQL DBNAME='xxx' LOGIN='xxx' SQL='some query'>   # opens the connection
>          ... display results...
> <iSQLMORE SQL='some other query'>  # reuses the connection
>          ....display other results....
> </iSQL>   # closes the connection
>
> Is there an equivalent in PHP to this, using the mySQL set of tags?
>
> Peter
>
> - - - - - - - - - - - - - - - - - - - - -
> Fourth Realm Solutions
> [EMAIL PROTECTED]
> http://www.fourthrealm.com
> Tel: 519-739-1652
> - - - - - - - - - - - - - - - - - - - - -
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
When you create a connection it is available to the
end of the script run. You can run as many queries as
you wish in the script and all will use the same
connection.

If you wish for multiple accesses to use the same
connection, I think you will have to use persistent
connections.

olinux



--- Kumar Lakshminarayanan <[EMAIL PROTECTED]> wrote:
> You can use persistent connections from php to mysql
> server
> using mysql_pconnect(host,user,passwd) then go on to
> use the returned link.
> this will open a new connection only if one is not
> available.
> kumar
> 
> "Support @ Fourthrealm.com" wrote:
> 
> > Another question about efficiency / using server
> resources:
> >
> > In another language I use, I can re-use an ODBC
> connection to make further
> > queries/update/etc to the database to save the
> overhead of closing and
> > reopening the connection to the db over and over.
> >
> > It works sometime like this (in the other
> language):
> > <iSQL DBNAME='xxx' LOGIN='xxx' SQL='some query'>  
> # opens the connection
> >          ... display results...
> > <iSQLMORE SQL='some other query'>  # reuses the
> connection
> >          ....display other results....
> > </iSQL>   # closes the connection
> >
> > Is there an equivalent in PHP to this, using the
> mySQL set of tags?
> >
> > Peter
> >
> > - - - - - - - - - - - - - - - - - - - - -
> > Fourth Realm Solutions
> > [EMAIL PROTECTED]
> > http://www.fourthrealm.com
> > Tel: 519-739-1652
> > - - - - - - - - - - - - - - - - - - - - -
> >
> > --
> > 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
> 


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
--- End Message ---
--- Begin Message ---
I dont have access to the php.ini file, is there anyway to access the
"include_path" setting programatically from php? Thanks


--- End Message ---
--- Begin Message ---
You could always just use .htacess to do it..

--
Matt "TrollBoy" Wiseman
Webmaster: Shoggoth.net
Site Designer: phpslash.org
The oldest and strongest emotion of mankind is fear,
and the oldest and strongest kind of fear is fear of the unknown.
-H.P. Lovecraft
---------------------------------------------------------
Please do not resell my e-mail address
to anyone or send me unsolicited e-mail
---------------------------------------------------------

"Christian Calloway" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I dont have access to the php.ini file, is there anyway to access the
> "include_path" setting programatically from php? Thanks
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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

Looking for a shopping cart. I've written plenty in the past but in 
Perl. I'm looking for one in PHP and I don't want to write my own.

I looked at this:

http://www.x-cart.com/

And I asked to see their code but I have not heard anything back.

I'm already favorable to anything that uses Smarty. I'd like something 
that is as OO as possible. Something that's got all the core features 
and is then easy to extend as every customer has their uniqure 
requirements.

Anyone got some suggestions?

Peter



http://www.coremodules.com/
Web Development and Support  at Affordable Prices
901-757-8322    [EMAIL PROTECTED]



--- End Message ---
--- Begin Message ---
I believe that x-cart provides the code when you
purchase. Looks like an inexpensive and full featured
solution. 

Check out www.oscommerce.com for an excellent open
source project that will rival most commercial
solutions. There are some live site examples in the
featured sites section. Many features and new
contributions daily.

olinux


--- "Peter J. Schoenster" <[EMAIL PROTECTED]>
wrote:
> Hi,
> 
> Looking for a shopping cart. I've written plenty in
> the past but in 
> Perl. I'm looking for one in PHP and I don't want to
> write my own.
> 
> I looked at this:
> 
> http://www.x-cart.com/
> 
> And I asked to see their code but I have not heard
> anything back.
> 
> I'm already favorable to anything that uses Smarty.
> I'd like something 
> that is as OO as possible. Something that's got all
> the core features 
> and is then easy to extend as every customer has
> their uniqure 
> requirements.
> 
> Anyone got some suggestions?
> 
> Peter
> 
> 
> 
> http://www.coremodules.com/
> Web Development and Support  at Affordable Prices
> 901-757-8322  [EMAIL PROTECTED]
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
--- End Message ---
--- Begin Message ---
http://www.fishcart.org/  - the guy who wrote this (in PHP) has been 
programming banking gateways for 20 years -- very security conscious. 
 The cart is very robust...

Best,

Nicole

Peter J. Schoenster wrote:

>Hi,
>
>Looking for a shopping cart. I've written plenty in the past but in 
>Perl. I'm looking for one in PHP and I don't want to write my own.
>
>I looked at this:
>
>http://www.x-cart.com/
>
>And I asked to see their code but I have not heard anything back.
>
>I'm already favorable to anything that uses Smarty. I'd like something 
>that is as OO as possible. Something that's got all the core features 
>and is then easy to extend as every customer has their uniqure 
>requirements.
>
>Anyone got some suggestions?
>
>Peter
>
>
>
>http://www.coremodules.com/
>Web Development and Support  at Affordable Prices
>901-757-8322   [EMAIL PROTECTED]
>
>
>
>
>  
>

-- 
########################
Nicole Lallande
[EMAIL PROTECTED]
760.753.6766
########################



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



I'm trying to generate a dropdown SELECT list from a database query. So far, 
all I've managed to create is multiple one-item dropdowns for each database 
entry spread across the page. Bad -- very bad!

I'd like normal drop-down SELECT behavior, but somehow the code escapes me. 
I've tried a bunch of permutations, but I either end up with an empty 
dropdown or multiple single entry messes. 

Is there anyway to iterate through this and achieve what I want?

I would greatly appreciate any hints what I'm missing here or doing wrong. 
Code follows.
Tia,
Andre


Code (using PostgreSQL):


<?php
. . .
$query = "SELECT * FROM rap WHERE rsponsor = '{$_SESSION['sid']}'";
$result = pg_exec($db, $query);
if (!$result) {exit;}
$numrows = pg_numrows($result);

if ($numrows == 0) {echo "<h2>Sorry!<br><br>'{$_POST['sid']}' is not in the
 our database.<br><br> Click 'Back' on
 your browser to enter another search.<br><br></h2>"; exit;}

$row = 0;
do
{
$myrow = pg_fetch_array($result,$row);
 if ($myrow['rupload'] != "")
{

 print "<SELECT name=rapped><option>{$myrow['rfname']}                                 
 
{$myrow['rsname']}</select>";
        
}

$row++;
}
while ($row < $numrows);
pg_close($db);
?>
--- End Message ---
--- Begin Message ---
Change <SELECT name=rapped> to <SELECT name=rapped size=1>

Sascha

Am Donnerstag, 19. September 2002 03:34 schrieb Andre Dubuc:
> I'm trying to generate a dropdown SELECT list from a database query. So
> far, all I've managed to create is multiple one-item dropdowns for each
> database entry spread across the page. Bad -- very bad!
>
> I'd like normal drop-down SELECT behavior, but somehow the code escapes me.
> I've tried a bunch of permutations, but I either end up with an empty
> dropdown or multiple single entry messes.
>
> Is there anyway to iterate through this and achieve what I want?
>
> I would greatly appreciate any hints what I'm missing here or doing wrong.
> Code follows.
> Tia,
> Andre
>
>
> Code (using PostgreSQL):
>
>
> <?php
> . . .
> $query = "SELECT * FROM rap WHERE rsponsor = '{$_SESSION['sid']}'";
> $result = pg_exec($db, $query);
> if (!$result) {exit;}
> $numrows = pg_numrows($result);
>
> if ($numrows == 0) {echo "<h2>Sorry!<br><br>'{$_POST['sid']}' is not in the
>  our database.<br><br> Click 'Back' on
>  your browser to enter another search.<br><br></h2>"; exit;}
>
> $row = 0;
> do
> {
> $myrow = pg_fetch_array($result,$row);
>  if ($myrow['rupload'] != "")
> {
>
>  print "<SELECT name=rapped><option>{$myrow['rfname']}
> {$myrow['rsname']}</select>";
>
> }
>
> $row++;
> }
> while ($row < $numrows);
> pg_close($db);
> ?>

--- End Message ---
--- Begin Message ---
Thanks Sascha,

Thought that would do the trick (at least I thought it should) but same 
results - a mess of single entry dropdowns. 

Perhaps the code should be after the 'row++;' ?

Sigh  . . . this is frustrating!

Andre



On Wednesday 18 September 2002 09:38 pm, Sascha Cunz wrote:
> Change <SELECT name=rapped> to <SELECT name=rapped size=1>
>
> Sascha
>
> Am Donnerstag, 19. September 2002 03:34 schrieb Andre Dubuc:
> > I'm trying to generate a dropdown SELECT list from a database query. So
> > far, all I've managed to create is multiple one-item dropdowns for each
> > database entry spread across the page. Bad -- very bad!
> >
> > I'd like normal drop-down SELECT behavior, but somehow the code escapes
> > me. I've tried a bunch of permutations, but I either end up with an empty
> > dropdown or multiple single entry messes.
> >
> > Is there anyway to iterate through this and achieve what I want?
> >
> > I would greatly appreciate any hints what I'm missing here or doing
> > wrong. Code follows.
> > Tia,
> > Andre
> >
> >
> > Code (using PostgreSQL):
> >
> >
> > <?php
> > . . .
> > $query = "SELECT * FROM rap WHERE rsponsor = '{$_SESSION['sid']}'";
> > $result = pg_exec($db, $query);
> > if (!$result) {exit;}
> > $numrows = pg_numrows($result);
> >
> > if ($numrows == 0) {echo "<h2>Sorry!<br><br>'{$_POST['sid']}' is not in
> > the our database.<br><br> Click 'Back' on
> >  your browser to enter another search.<br><br></h2>"; exit;}
> >
> > $row = 0;
> > do
> > {
> > $myrow = pg_fetch_array($result,$row);
> >  if ($myrow['rupload'] != "")
> > {
> >
> >  print "<SELECT name=rapped><option>{$myrow['rfname']}
> > {$myrow['rsname']}</select>";
> >
> > }
> >
> > $row++;
> > }
> > while ($row < $numrows);
> > pg_close($db);
> > ?>
--- End Message ---
--- Begin Message ---
Move <select></select> outside the do-while loop:

print "<SELECT name=rapped>";

$row = 0;
do
{
         $myrow = pg_fetch_array($result,$row);
         if ($myrow['rupload'] != "") {

                 print "<option>{$myrow['rfname']} 
{$myrow['rsname']}</option>";

         }

         $row++;
} while ($row < $numrows);

print "</select>";

pg_close($db);

--

- Jacob

At 09:56 09/19/2002, Andre Dubuc wrote:
> > > <?php
> > > . . .
> > > $query = "SELECT * FROM rap WHERE rsponsor = '{$_SESSION['sid']}'";
> > > $result = pg_exec($db, $query);
> > > if (!$result) {exit;}
> > > $numrows = pg_numrows($result);
> > >
> > > if ($numrows == 0) {echo "<h2>Sorry!<br><br>'{$_POST['sid']}' is not in
> > > the our database.<br><br> Click 'Back' on
> > >  your browser to enter another search.<br><br></h2>"; exit;}
> > >
> > > $row = 0;
> > > do
> > > {
> > > $myrow = pg_fetch_array($result,$row);
> > >  if ($myrow['rupload'] != "")
> > > {
> > >
> > >  print "<SELECT name=rapped><option>{$myrow['rfname']}
> > > {$myrow['rsname']}</select>";
> > >
> > > }
> > >
> > > $row++;
> > > }
> > > while ($row < $numrows);
> > > pg_close($db);
> > > ?>

--- End Message ---
--- Begin Message ---
Thanks Jacob and Sascha,

I would've struggled with that one for a day before I realized what was 
wrong. Thanks again -- it works great!

Regards (and thanks yet again :>)
Andre


On Wednesday 18 September 2002 09:54 pm, Jacob Miller wrote:
> Move <select></select> outside the do-while loop:
>
> print "<SELECT name=rapped>";
>
> $row = 0;
> do
> {
>          $myrow = pg_fetch_array($result,$row);
>          if ($myrow['rupload'] != "") {
>
>                  print "<option>{$myrow['rfname']}
> {$myrow['rsname']}</option>";
>
>          }
>
>          $row++;
> } while ($row < $numrows);
>
> print "</select>";
>
> pg_close($db);
--- End Message ---
--- Begin Message ---
Hello people,
Thanks for all your help. I guess I'll go with

$oid = pg_last_oid($result);
select id from table where oid = $oid;

If i'm not mistaken, there will no race issue here:
pg_last_oid($result) has already returned me the row
that 'I' have just inserted, based on $result, regardless whether there is
another
user doing an insert. I already have a reference to a row i just inserted.

On the other hand,
BEGIN
INSERT ... whatever
SELECT idno ORDER BY (idno) DESC LIMIT 1;
END;

will have some 'time' between the 'insert' and the 'select'.
There is no reference to a row based on $result.
There would still probably be a race issue here (just my opinion,
not a fact). But if there's anyone could explain the internals,
I'd be glad.

Thanks for all who helped.

Sincerely,
Faisal




-----Original Message-----
From: Leonid Mamtchenkov [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 5:35 AM
To: Faisal Abdullah
Cc: Marek Kilimajer; PHP
Subject: Re: [PHP] Auto-increment value


Dear Faisal Abdullah,

Once you wrote about "RE: [PHP] Auto-increment value":
> > There is a similar one for postgresql as well: pg_last_oid() .
>
> I tried that. It gives me 24807, instead of 5.
> Or is oid is a reference to something else, which would
> lead me to the '5' i'm looking for?

I'd bet that 24807 is your oid.  Check the difference between
"SELECT * FROM table;" and "SELECT oid,* FROM table;".

HTH.

> -- snip snip --
>
> if($result = pg_exec($db, $sql))
>     {
>       $query = "success";
>       echo "oid : " .pg_last_oid($result);
>       }
>
> -- snip snip --

--
Best regards,
  Leonid Mamtchenkov, RHCE
  System Administrator
  Francoudi & Stephanou Ltd.

BOFH: somebody was calculating pi on the server

______________________________________

--- End Message ---
--- Begin Message ---
Hi...

I've written a shopping cart program that is in use at www.dangeo.com and
I'm having a weird problem that has just been brought to my attention.

As far as I can tell everything works perfectly fine with the shopping cart
in windows 98, and 2000. However the problem I'm having is that when
customers using XP get into the shopping cart they can't get past the screen
where they put in their address. I haven't been able to duplicate this
problem.

What I'm hoping is that some of you might be able to take a look at it,
duplicate the problem, and give me some suggestions as to what the problem
is.


Jason Cathcart
Check Out My Site: http://www.biohazardous.org

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

As an adendum to this... my initial thoughts are that the forms are not
posting correctly in XP. I'm using the POST method.


Jason Cathcart
Check Out My Site: http://www.biohazardous.org
  -----Original Message-----
  From: Jason [mailto:[EMAIL PROTECTED]]
  Sent: September 18, 2002 7:50 PM
  To: Php-General
  Subject: Weird problem with Windows XP and IE6


  Hi...

  I've written a shopping cart program that is in use at www.dangeo.com and
I'm having a weird problem that has just been brought to my attention.

  As far as I can tell everything works perfectly fine with the shopping
cart in windows 98, and 2000. However the problem I'm having is that when
customers using XP get into the shopping cart they can't get past the screen
where they put in their address. I haven't been able to duplicate this
problem.

  What I'm hoping is that some of you might be able to take a look at it,
duplicate the problem, and give me some suggestions as to what the problem
is.


  Jason Cathcart
  Check Out My Site: http://www.biohazardous.org

--- End Message ---
--- Begin Message ---
Just as Kevin Stone said, you can either use one of these constructions:

function func1() {
  global $myarray;
  array_push($myarray,1);
}
# _or_
function func2() {
  array_push($GLOBALS['myarray'],1);
}

In fact, there is no performance decrease, because PHP will internally use the 
same mechanism to access the array - as it would if you were not in a 
function.

Another way would be to pass the array as a reference:

function func3(&$myarray) {
  array_push($myarray, 1);
}

but this might decrease performace (in compare to the other ways, you will not 
really notice it).

Sascha


Am Mittwoch, 18. September 2002 23:54 schrieb Anup:
> I want to use arrays (that are outside of a function) to be visible to a
> function. I understand that I must you global. But I was wondering is it
> possible to make it visible to only certain functions, similar to the
> 'friend' keyword in C (or C++ ?) ? The reason, is that I don't feel
> comfortable having globals, (I was brought up that way). Also, if you
> actually declare something global are there any disadvantages such as
> performance hits?

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

Thursday, September 19, 2002, 5:29:06 AM, you wrote:
BY> What does this do?

Here is the class again with all errors fixed and some unfinished bits
but it should be enough to get you started. It uses recursion as it
repeats after one thousand .. ie one, two, three .... one thousand,
two thousand, three thousand...


class num_to_text {
        var $mode;      //NUMERIC CURRENCY
        var $words = 
array(0=>array('zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'),
                                                        
1=>array('zero','one','twenty','thirty','fourty','fifty','sixty','seventy','eighty','ninety'),
                                                        
2=>array('thousand','million'));
        var $money = array(0=>array('Dollar','Dollars'),
                                                                                 
1=>array('Cent','Cents'));
        function num_class($mode = 'NUMERIC'){
                $this->mode = $mode;
        }
        function convert($num){
                return $this->num($num,1);
        }
        function num($num,$key = 0){
                static $t;
                static $call;
                $res = intval($num/100);
                $left = $num%100;
                if($key == 1){ //first non recursive call reset text and 
thousand/million toggle
                        $t = "";
                        $call = 0;
                }
                else{
                        // do we need to print thousand as this is a recursive call
                        if($num%1000 > 0)$t = ' '.$this->words[2][$call].' '.$t;
                        $call ^= 1;     //toggle call for next recursion
                }
                if($left <= 20){ // no need to split it
                        if($left == 0){ // is the whole mess just zero
                                if($res == 0) $t = $this->words[0][$left].$t;
                        }
                        else{
                                $t = $this->words[0][$left].$t;
                        }
                }
                else{ //need to split it up
                        $tens = intval($left/10);
                        $units = $left%10;
                        ($units > 0)? $units = ' '.$this->words[0][$units] : $units = 
''; // eg thirty or thirty one
                        $t = $this->words[1][$tens].$units.$t;
                }
                if($res < 10){
                        if($res > 0){
                                ($left == 0)? $and = '':$and = ' and '; // do we need 
to print 'and'
                                if($res > 0) $t = $this->words[0][$res]. " 
hundred".$and.$t;
                        }
                }
                else{
                        $res = $res%10;
                        if($res > 0){
                                ($left == 0)? $and = '':$and = ' and ';
                                $t = $this->words[0][$res]. " hundred".$and.$t;
                        }
                        else{
                                if($left > 0)$t = ' and '.$t;
                        }
                        $num = intval($num/1000);
                        $this->num($num);
                }
                return $t;
        }
}

//usage

$n2t = new num_to_text();
for($num = 0;$num < 11;$num++){
        echo $num.' '.$n2t->convert($num).'<br>';
}



-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
Hello everyone,
In a simple signup form that I'm using, I send the
variables to a script, which performs a function if
($submit == "register") {
   function();
 }

The problem is, my signup form isn't passing the
submit variable, though it is passing the other
variables in the form.

The strange thing is, when I try this in the Opera web
browser, the $submit variable does get passed along,
but in both Mozilla and Konqueror, it does not.

Have I made a little error in the following code?  Any
thoughts?

<center>
<div id="loginform">

<center>Join <? print $SITE_NAME; ?>...</center><br />
<br />
<form action="index.php" method="get" name="signup">
Username:<br />
 <input type="text" name="username" /><br /><br />

Name:<br />
 <input type="text" name="name" /><br />
Email:<br />
 <input type="text" name="email" /><br />
Homepage:<br />
 <input type="text" name="homepage" /><br />
About you:<br />
<textarea name="description" rows="5" cols="19">
</textarea><br />


Password:<br />
 <input type="password" name="password" /><br />
Confirm Password:<br />
 <input type="password" name="password2" /><br />
<br />
 
 <input type="submit" name="submit" value="register"
/><br />
</form>

</div>
</center>



Your help is greatly appreciated,
Jesse Lawrence


______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca
--- End Message ---
--- Begin Message ---
I've had this same problem.  It seems that the value of submit is only sent 
if the button is clicked (netscape and internet explorer).  Could it be 
that you're using the enter key to submit the form?

The solution I used was to remove the value assignment to the submit button 
and set it in a hidden variable

<input type="hidden" name="submit" value="register">

- Jacob

At 10:58 09/19/2002, Jesse Lawrence wrote:
>Hello everyone,
>In a simple signup form that I'm using, I send the
>variables to a script, which performs a function if
>($submit == "register") {
>    function();
>  }
>
>The problem is, my signup form isn't passing the
>submit variable, though it is passing the other
>variables in the form.
>
>The strange thing is, when I try this in the Opera web
>browser, the $submit variable does get passed along,
>but in both Mozilla and Konqueror, it does not.
>
>Have I made a little error in the following code?  Any
>thoughts?
>
><center>
><div id="loginform">
>
><center>Join <? print $SITE_NAME; ?>...</center><br />
><br />
><form action="index.php" method="get" name="signup">
>Username:<br />
>  <input type="text" name="username" /><br /><br />
>
>Name:<br />
>  <input type="text" name="name" /><br />
>Email:<br />
>  <input type="text" name="email" /><br />
>Homepage:<br />
>  <input type="text" name="homepage" /><br />
>About you:<br />
><textarea name="description" rows="5" cols="19">
></textarea><br />
>
>
>Password:<br />
>  <input type="password" name="password" /><br />
>Confirm Password:<br />
>  <input type="password" name="password2" /><br />
><br />
>
>  <input type="submit" name="submit" value="register"
>/><br />
></form>
>
></div>
></center>
>
>
>
>Your help is greatly appreciated,
>Jesse Lawrence
>
>
>______________________________________________________________________
>Post your free ad now! http://personals.yahoo.ca
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Hmmm, that was the solution.  That's kind of a strange
little thing isn't it?

Thanks a lot for your help,

Jesse








I've had this same problem.  It seems that the value
of submit is only sent
if the button is clicked (netscape and internet
explorer).  Could it be
that you're using the enter key to submit the form?

The solution I used was to remove the value assignment
to the submit button
and set it in a hidden variable

<input type="hidden" name="submit" value="register">

- Jacob

At 10:58 09/19/2002, Jesse Lawrence wrote:
>Hello everyone,
>In a simple signup form that I'm using, I send the
>variables to a script, which performs a function if
>($submit == "register") {
>    function();
>  }
>
>The problem is, my signup form isn't passing the
>submit variable, though it is passing the other
>variables in the form.
>
>The strange thing is, when I try this in the Opera
web
>browser, the $submit variable does get passed along,
>but in both Mozilla and Konqueror, it does not.
>
>Have I made a little error in the following code? 
Any
>thoughts?
>
><center>
><div id="loginform">
>
><center>Join <? print $SITE_NAME; ?>...</center><br
/>
><br />
><form action="index.php" method="get" name="signup">
>Username:<br />
>  <input type="text" name="username" /><br /><br />
>
>Name:<br />
>  <input type="text" name="name" /><br />
>Email:<br />
>  <input type="text" name="email" /><br />
>Homepage:<br />
>  <input type="text" name="homepage" /><br />
>About you:<br />
><textarea name="description" rows="5" cols="19">
></textarea><br />
>
>
>Password:<br />
>  <input type="password" name="password" /><br />
>Confirm Password:<br />
>  <input type="password" name="password2" /><br />
><br />
>
>  <input type="submit" name="submit" value="register"
>/><br />
></form>
>
></div>
></center>
>
>
>
>Your help is greatly appreciated,
>Jesse Lawrence
>
>


______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca
--- End Message ---
--- Begin Message ---

My question is regarding default arguments -- is it possible to define a default
argument that is itself a variable?

I'd like to do the following:

    function archive ($max_size = 20560, $archive_dir = "${DOCUMENT_ROOT}/tmp/") 

but I seem to get parse errors unless I do the following:

    function archive ($max_size = 20560, $archive_dir = "/var/www/tmp/")

Is it possible to do something approaching the latter?

Monique Y. Herman
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Try:

function archive ($max_size = 20560, $archive_dir = ${DOCUMENT_ROOT}.'/tmp/')

On Wed, 18 Sep 2002 23:25:08 +0000, Monique Y. Herman wrote:

> 
> My question is regarding default arguments -- is it possible to define a default
> argument that is itself a variable?
> 
> I'd like to do the following:
> 
>     function archive ($max_size = 20560, $archive_dir = "${DOCUMENT_ROOT}/tmp/") 
> 
> but I seem to get parse errors unless I do the following:
> 
>     function archive ($max_size = 20560, $archive_dir = "/var/www/tmp/")
> 
> Is it possible to do something approaching the latter?
> 
> Monique Y. Herman
> [EMAIL PROTECTED]

-- 
 Jason Morehouse (jm[@]netconcepts[.]com)
 Netconcepts - http://www.netconcepts.com
 Auckland, New Zealand

 Linux: Because rebooting is for adding hardware.

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

I'd started another question, realized the answer to it, and typed in another
question without checking the subject ... mea culpa!

Monique Y. Herman
[EMAIL PROTECTED]


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

Can I compile a regexp as I can in perl?

We have various possible values that we want to strip out of a string and
we store them in an array so that users can update with their own.  To
wit:

  $noadobe =
    array
      (
        "File written by Adobe Photoshop",
        "LEAD Technologies Inc." ,
        "more pesky text" ,
      ) ;

We want to make it easy on the users, so we're not going to figure any
regular expressions belong in there; I'll just use a greedy .* to suck up
everything that starts with any of these matches.

In my code I can certainly 

  $noadoberegexp = "(" . join("|",$noadobe) . ").*" ;

and then

  $cleanstring = eregi_replace("$noadoberegexp","",$stripstring) ;

but 1) I haven't tested this code yet :-) and 2) I wonder if I'll run
into long runtimes when we get lots of strings to match.


TIA & HAND

:-D
-- 
David T-G                      * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: msg79116/pgp00000.pgp
Description: PGP signature

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

Is there any way to redefine or undefine (to then redefine) a function?
We have an image handling function, for instance, and would like to let
our users put in their own definition instead.  I haven't yet found
anything that will allow this...


TIA & HAND

:-D
-- 
David T-G                      * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: msg79116/pgp00001.pgp
Description: PGP signature

--- End Message ---
--- Begin Message ---
I've been doing PHP for about 2 years now. The code I write is generally
procedural although I have been using a MySQL class to do some db stuff as
of late.

Over last few months, I've been learning Cocoa. If you don't know its an
OBJ-C based API to develop apps for Mac OS X.

By doing so I  want more and more of my PHP to be purely OO. I'm fairly
aware of how to write my own classes for data but are their any frameworks
out there to do the foundation stuff already?

Thanks :-)

~ Mike
-- 
Mike Zornek | Project Leader
Apple Student Developers
The Insanely Great Site with the Insanely Long URL
http://www.applestudentdevelopers.org

Personal Site: 
http://www.mikezornek.com

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

On 09/19/2002 01:50 AM, Michael Zornek wrote:
> I've been doing PHP for about 2 years now. The code I write is generally
> procedural although I have been using a MySQL class to do some db stuff as
> of late.
> 
> Over last few months, I've been learning Cocoa. If you don't know its an
> OBJ-C based API to develop apps for Mac OS X.
> 
> By doing so I  want more and more of my PHP to be purely OO. I'm fairly
> aware of how to write my own classes for data but are their any frameworks
> out there to do the foundation stuff already?

Have you looked at the http://www.phpclasses.org/ site?

What kind of frameworks are you looking for?


-- 

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
Yes, I'm STILL a newbie :) I've gotten pretty far in a few days thanks to
you all. I have a new question for you, maybe this is a bit easier than my
last issue.

Still using my text file example, which has lines such as:

0706010102|01.01.02|16:00|Serie C2|02|Forlě|Florentia Viola|
0610010102|01.07.02|16:00|Serie C2|05|Florentia Viola|Gubbio|
1806190702|19.07.02|16:00|Serie C2|05|Savona|Florentia Viola|

I am able to with a form, create a new addition to the file. What I'd like
to do now however, is before writing to the file, check the second field
(the date in this case) and if it is the same as what is being submitted,
then I want to buy using an if...else statement stop it from being written.

What I tried was to create an array called $getdate by exploding the file
that has the text above. Then, I also created a variable called $datetest
which was from the form such as: $datetest = ("$day.$month.$year");

so Now i wanted to compare $getdate[1] to $datetest and if any of the
exploded arrays from $getdate[1] matched up with $getdate, i.e. what is
being submitted from the form, then it would not go to write the file.

I tried it like so:

$fd = fopen ($schedule, "r");
while (!feof ($fd))
{
$currentlines = fgets($fd, 4096);
$getdate = explode("|", $currentlines);
$datetest = ("$day.$month.$year");
if (preg_match ($getdate[1] , $datetest)) {
echo 'date already listed';
} else {
$fp = fopen($schedule, "w");
fwrite($fp,
"$current\n$homename[0]$awayname[0]$day$month$year|$day.$month.$year|$matcht
ime|$competition|$round|$homename[1]|$awayname[1]|");
fclose($fp);
echo 'success';
}

I am not even sure if this is the function i need to use, but if it is, my
syntaxt must be wrong, because I have tried all combinaions and I keep
getting errors.

Any suggestions?

Thanks as always

-Tree


--- End Message ---
--- Begin Message ---
Paul,

PN> It looks like that string has been serialized multiple times

Many thanks - that is the problem! I think that this qualifies as one
of my more creative bugs...

Can I ask you how you spotted this? Pretty impressive, considering you
only had the string itself to go on.

Thanks again,

-- 
Geoff Caplan
Advantae Ltd

mailto:[EMAIL PROTECTED]
http://www.advantae.com

--- End Message ---
--- Begin Message ---
If you've seen a serialised variable a few times, you get to know how one is
set up and how to interpret it. If you're using serialised variables, I'd
suggest serialising a few simple ones and see what the output looks like so
that you can see when things are going amiss.

This is one way that I debug things. Instead of var_dump()ing or
print_r()ing something, I'll "echo serialize(...)". It's more compact than
var_dump/print_r

Martin

-----Original Message-----
From: Geoff Caplan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 3:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Unserialize stopped working after php & db upgrade


Paul,

PN> It looks like that string has been serialized multiple times

Many thanks - that is the problem! I think that this qualifies as one
of my more creative bugs...

Can I ask you how you spotted this? Pretty impressive, considering you
only had the string itself to go on.

Thanks again,

-- 
Geoff Caplan
Advantae Ltd

mailto:[EMAIL PROTECTED]
http://www.advantae.com


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

Hello.

How do you decrypt a data that's encrypted with crypt($data).

Now, the php documents says crypt() is a one-way crypting function, so
there is no decrypt() function. I was wondering if someone could shed some
light on alternative ways to encrypt & decrypt data.

I've looked at mcrypt_generic and mdecrypt_generic, but am confused by the
'resource td' parameter. Perhaps, someone can explain that as well.

Any help is greatly apprciated.

-john

=P e p i e  D e s i g n s=
 www.pepiedesigns.com
 Providing Solutions That Increase Productivity

 Web Developement. Database. Hosting. Multimedia.

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


I am using PHP with Windows XP. I am trying to have a ".exe" program (written and 
compiled in C) launched by my PHP script, using either system(), passthru()... That 
works great ... as long as I only have one request at a time. When I have two (or more 
request) at the same time (coming from different browser sessions), the execution of 
the .exe program seems to be aborted for all sessions as soon as it is finished for 
one of the sessions. Therefore only the first finishing session gets the good result, 
the other sessions keeping waiting for an output that will never come. 

The same problem arises if those are different .exe programs that are launched at the 
same time, for example program1.exe, program2.exe and program3.exe ; if program1.exe 
ends first, program2.exe and program3.exe get aborted ... How come ? How can I avoid 
that ? 

By advance, thank you for your help and comments ...

Best regards from Belgium,


                    Jean-Marc

--- End Message ---
--- Begin Message ---
i programmed a metasearchengine with php - it works but it is to slow.

does someone know how to do parallel connections to searchengines ?

Let s say i have 4 php scripts - each script gets data from a
searchengine. I have included those 4 script in my  resutl html page
(via include..) - but i have the feeling that php includes the first
script (which connect to searchengine 1)  and after it got all
data it includes the second script - gets the data and include then
scritp 3..:::

Does someone know hot to connect those 4 scripts parallel to the
searchengines and not seriell?

greetings

Jens

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

This is probably a stupid question, but I can't figure it out. I've 
been trying to search the PHP site for an answer without luck.

I want to return results in an array from an extension. The array may 
or may not be defined. The array may or may not contain values. The 
PHP function could be something like

function modarray(&$inoutarray)
{
        if (!isset($inoutarray))
        {
                $inoutarray = array();
        }
        $inoutarray[] = newval1;
        $inoutarray[] = newval2;
}

How do I do that in an extension? I want to adhere to the 
recommendation that allow_call_time_pass_reference should be off.

-Ole
-- 
______________________________________
Konsulentfirmaet Ole Stakemann ApS
Fortunvej 55
DK-2920  Charlottenlund
Denmark

e-mail: [EMAIL PROTECTED]
Phone: +45 39 64 10 68
Fax: +45 39 64 10 67
--- End Message ---
--- Begin Message ---

----- Original Message -----
From: "Vergoz Michael (SYSDOOR)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 19, 2002 12:38 PM
Subject: [PHP-DEV] and so... there is a security problem.


Hi list,

i think that you have to return a _s64 per default, cuz for exemple i'm
using some identification coded on _s64 if i jump 21 474 836 47, intval()
will return to me a wrong number (normal) but i _can't_ know if that that
number is a valid _s64 (_s64) and there can have some big security problems

Exemple:

$id = intval($_GET['id']);
$query = "
    SELECT
        \"proute\"
    FORM
        \"polom\"
    WHERE
        id = $id
";

Best regards,
Vergoz Michael
SYSDOOR


--- End Message ---

Reply via email to