Re: [PHP] PHP Testing

2003-01-02 Thread Jim Lucas
Well, I have been chaning different settings the past few days and noticed
that my messages had not been posted to the board.  Finally got it going.

But here is my question, now that my email IS working.

can you override the engine setting in the virtual host block

I am running
  Apache 1.3.26 & PHP 4.2.2

ie:

in the global area of the httpd.conf file I put
  php_admin_value engine Off

and then do the following for my VirtualHost blocks


  DocumentRoot  /some/path/public_html
  php_admin_value engine On



When I do this.  PHP doesn't parse the files.

It just prints the php code in the sent page.

Is this possible, can it be done,  and if so, how?

Jim


- Original Message -
From: "Paul Marinas" <[EMAIL PROTECTED]>
To: "Jim Lucas" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, January 02, 2003 4:33 PM
Subject: Re: [PHP] PHP Testing


> :)
>
> Paul Marinas
> Technical Support
> RDS Craiova
>
>
> Phone:  +402-51-410-194
> Mobile: +407-22-451-439
> Fax:+402-51-416-579
> www.rdsnet.ro
> .
>
> Privileged/Confidential Information may be contained in this message. If
you
> are not the addressee indicated in this
> message (or responsible for delivery of the message to such person), you
may
> not copy or deliver this message to
> anyone. In such a case, you should destroy this message and kindly notify
> the sender by reply e-mail.
>
> On Thu, 2 Jan 2003, Jim Lucas wrote:
>
> > checking return emails..
> >
>
> --
> 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




Re: [PHP] Windows PHP vs Linux PHP

2003-01-15 Thread Jim Lucas
it has to do with declaring all php variables before using them in the
script.

$var='';

then do something with the variable.

Jim
- Original Message -
From: "Beauford.2002" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 9:52 AM
Subject: [PHP] Windows PHP vs Linux PHP


> Hi,
>
> I asked previously about the differences between the two and the concensus
> was any differences are in the operating systems themselves and not with
> PHP. Knowing this, how do I get rid of these errors that keep coming up in
> Windows, that don't in Linux. One specific one is  "Notice: Undefined
> variable: add in E:\IIS Webs\address.php on line 3"
>
> Someone said to turn on register_globals which I have. Another suggestion
> was to put a @ sign in from of all variables. This is a real pain. Anyone
> have any other suggestions, or is this basically it?
>
> Also, is there anything else that anyone can think of that I may have to
> look forward to using PHP under Windows?
>
> TIA
>
>
>
>
> --
> 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




Re: [PHP] $HTTP_GET_VARS

2003-01-17 Thread Jim Lucas
checkout the most recent version of the help documents from php.net.  it
will tell you.

something to do with $_GET,  i think...

Jim
- Original Message -
From: "Mike Tuller" <[EMAIL PROTECTED]>
To: "php mailing list" <[EMAIL PROTECTED]>
Sent: Friday, January 17, 2003 2:05 PM
Subject: [PHP] $HTTP_GET_VARS


> I am following an example in a book and have run into a problem with a
> script that I am trying to run under PHP 4.3.0. What I have is a page
> that you click on an id number that is from a listing in a database,
> and it is supposed to take you to a page to edit that item. I have the
> id sent in the url (http://127.0.0.1/asset/editasset.php?id=3) and the
> book says to use $HTTP_GET_VARS to take that id and display the record
> for editing on a separate page. When I use $HTTP_GET_VARS nothing is
> returned, and I am thinking that I can't use $HTTP_GET_VARS in PHP
> 4.3.0, so what do I need to use?
>
> Thanks,
> Mike
>
>
> --
> 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




Re: [PHP] Loop inside a table

2003-01-20 Thread Jim Lucas
instead of doing that your should do this

$message = "



title goes here


";

for ($x = 0; $x < $num_rows; $x++)
{
$message .= "some stuff";
}

$message .= "
";

you were also missing your last double quote.

Jim

- Original Message -
From: "Cesar Aracena" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 20, 2003 9:37 AM
Subject: [PHP] Loop inside a table


Hi all,

I always make for loops inside tables so I usually don't have problems
with it, but this case is a little different. I'm making a mail program
for my client to receive a mail each time a customer places an order in
his site.

Inside the mail program, I declaring a value called $message where an
HTML form is being created dynamically, depending on the products
selected by the customer or visitor.

The problem is that PHP apparently won't let me do a for loop inside
this variable. I have something like this:

$message = "



title goes here


".
for ($x = 0; $x < $num_rows; $x++)
{
//several lines made dynamically
}
."

;

and the error goes like: unexpected T_FOR in line xxx (where my for loop
is). I've never tried this in the past, so I assumed it had to be done
normally but I see I was mistaken. Anyone did this before? What's the
problem here?

Thanks in advance,

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina




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




Re: [PHP] Cannot show reuploaded image file on page unless manual refresh

2003-01-20 Thread Jim Lucas
I would add the modification time of the file in question with

filetime($filename);

that way you will be sure to get a unique argurment.

Jim

- Original Message -
From: <[EMAIL PROTECTED]>
To: "Chris Shiflett" <[EMAIL PROTECTED]>
Cc: "Phil Powell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Monday, January 20, 2003 10:48 AM
Subject: Re: [PHP] Cannot show reuploaded image file on page unless manual
refresh


>
>  Aha! Something I can chime in on. I happened across the same scenario a
> few months back. The list helped me then so I'll give back.
>
>  Call the image using a random identifier.
>
> $rand = rand(1000, );
>
> echo "http://someurl.com/image.jpg?$rand";;
>
> Since the browser will more than likely not have the image file identified
> by the random number it must request it again from the server. Works
> great where I need it!
>
> Ed
>
> On Mon, 20 Jan 2003, Chris Shiflett wrote:
>
> > --- Phil Powell <[EMAIL PROTECTED]> wrote:
> > > I am using the following header() functions to force
> > > view.php to not cache:
> > >
> > > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
> > > header("Last-Modified: " . gmdate("D, d M Y H:i:s") .
> > > " GMT");
> > > header("Cache-Control: no-store, no-cache,
> > > must-revalidate");
> > > header("Cache-Control: post-check=0, pre-check=0",
> > > false);
> > > header("Pragma: no-cache");
> >
> > :-)
> >
> > I think you killed it.
> >
> > > However, when a user reuploads a file in manage.php, it
> > > does a form post onto manage.php and reuploads the file
> > > (which I verified works).  However, when redirected via
> > > header() to view.php, they still see their OLD image
> > > file, NOT the new one!  Unless I manually refresh the
> > > page, they never see it, until they manually refresh the
> > > page, then the new image file appears!
> >
> > Right.
> >
> > I think you are forgetting that the image is not really
> > part of the PHP resource. Meaning, this is the series of
> > events for a PHP script that refernces a single image
> > called bar.jpg using the  tag:
> >
> > 1. HTTP request sent for foo.php (Web client -> Web server)
> > 2. HTTP response sent that includes the output of foo.php
> >(Web server -> Web client)
> > 3. Web client (browser) notices  tag referenced in
> >the HTML.
> > 4. HTTP request sent for bar.jpg (Web client -> Web server)
> > 5. HTTP response sent that includes bar.jpg
> >
> > So, the headers that you are setting only matter for the
> > resource returned in step 2. Meaning, the HTML output of
> > foo.php is not cached. The image, since it is returned by
> > the Web server and not your PHP script, is cached.
> >
> > 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
>
>



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




Re: [PHP] Re: Cannot show reuploaded image file on page unless manual refresh

2003-01-20 Thread Jim Lucas
i think you missunderstood what I said.

in the image tag that you create to display the image, you could do this



that would make the URL different when each page time the image was
replaced.

I would use filetime() because it would not cause extra downloads if the
file wasn't different.

if someone looked at the file 2 seconds apart and it didn't change, it was
waisted time and bandwidth down loading the file again.

Jim


- Original Message -
From: "Philip Hallstrom" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 20, 2003 4:11 PM
Subject: [PHP] Re: Cannot show reuploaded image file on page unless manual
refresh


> I wonder if appending time() would be better... granular to a second and
> you save the filesystem lookup effort??
>
> On Mon, 20 Jan 2003, Jim Lucas wrote:
>
> > I would add the modification time of the file in question with
> >
> > filetime($filename);
> >
> > that way you will be sure to get a unique argurment.
> >
> > Jim
> >
> > - Original Message -
> > From: <[EMAIL PROTECTED]>
> > To: "Chris Shiflett" <[EMAIL PROTECTED]>
> > Cc: "Phil Powell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
> > <[EMAIL PROTECTED]>
> > Sent: Monday, January 20, 2003 10:48 AM
> > Subject: Re:  Cannot show reuploaded image file on page unless manual
> > refresh
> >
> >
> > >
> > >  Aha! Something I can chime in on. I happened across the same scenario
a
> > > few months back. The list helped me then so I'll give back.
> > >
> > >  Call the image using a random identifier.
> > >
> > > $rand = rand(1000, );
> > >
> > > echo "http://someurl.com/image.jpg?$rand";;
> > >
> > > Since the browser will more than likely not have the image file
identified
> > > by the random number it must request it again from the server. Works
> > > great where I need it!
> > >
> > > Ed
> > >
> > > On Mon, 20 Jan 2003, Chris Shiflett wrote:
> > >
> > > > --- Phil Powell <[EMAIL PROTECTED]> wrote:
> > > > > I am using the following header() functions to force
> > > > > view.php to not cache:
> > > > >
> > > > > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
> > > > > header("Last-Modified: " . gmdate("D, d M Y H:i:s") .
> > > > > " GMT");
> > > > > header("Cache-Control: no-store, no-cache,
> > > > > must-revalidate");
> > > > > header("Cache-Control: post-check=0, pre-check=0",
> > > > > false);
> > > > > header("Pragma: no-cache");
> > > >
> > > > :-)
> > > >
> > > > I think you killed it.
> > > >
> > > > > However, when a user reuploads a file in manage.php, it
> > > > > does a form post onto manage.php and reuploads the file
> > > > > (which I verified works).  However, when redirected via
> > > > > header() to view.php, they still see their OLD image
> > > > > file, NOT the new one!  Unless I manually refresh the
> > > > > page, they never see it, until they manually refresh the
> > > > > page, then the new image file appears!
> > > >
> > > > Right.
> > > >
> > > > I think you are forgetting that the image is not really
> > > > part of the PHP resource. Meaning, this is the series of
> > > > events for a PHP script that refernces a single image
> > > > called bar.jpg using the  tag:
> > > >
> > > > 1. HTTP request sent for foo.php (Web client -> Web server)
> > > > 2. HTTP response sent that includes the output of foo.php
> > > >(Web server -> Web client)
> > > > 3. Web client (browser) notices  tag referenced in
> > > >the HTML.
> > > > 4. HTTP request sent for bar.jpg (Web client -> Web server)
> > > > 5. HTTP response sent that includes bar.jpg
> > > >
> > > > So, the headers that you are setting only matter for the
> > > > resource returned in step 2. Meaning, the HTML output of
> > > > foo.php is not cached. The image, since it is returned by
> > > > the Web server and not your PHP script, is cached.
> > > >
> > > > 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
> > >
> > >
> >
> >
> >
> > --
> > 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
>
>



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




Re: [PHP] pop-up problem

2003-01-20 Thread Jim Lucas
I have found that with the popup stopper that I have installed on my
machine, Pop-up Stopper from Panic Ware, that I can't even start up a new
instance of IE without it killing the new window.  I have netscape 4,6,7 and
mozilla installed on my machine and it won't allow me to start up more then
one copy of netscape or mozilla at a time.

Jim
- Original Message -
From: "Step Schwarz" <[EMAIL PROTECTED]>
To: "Mark McCulligh" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, January 20, 2003 4:07 PM
Subject: Re: [PHP] pop-up problem


> on 1/20/03 4:47 PM, Mark McCulligh at [EMAIL PROTECTED] wrote:
>
> > What does IE do?
>
> Hi Mark,
>
> IE, as far as I know, doesn't have any built-in pop-up killer.
>
> Pop-up killers generally only block pop-ups that either weren't requested
by
> the visitor -- that is, no link was clicked -- or that reside on a
different
> server than the page opening the pop-up.  I imagine your help system
should
> be fine unless your visitors have JavaScript disabled (pop-ups won't work
> without JavaScript) or there's an error in you JavaScript that's
preventing
> the pop-up from working on one browser or another.
>
> Hope this helps,
> -Step
>
>
> --
> 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




Re: [PHP] DOWNLOAD

2003-01-21 Thread Jim Lucas
People often for get about a little problem that happens with the




I found a bug when developing a download script a year or so ago.

You can't have the 'attachment;' part in IE.  It did some funky stuff

and netscape 4 would die without it.

Jim

- Original Message -
From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
To: "'Shaun van den Berg'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, January 21, 2003 1:44 AM
Subject: RE: [PHP] DOWNLOAD


> Create a script that reads the contents of a file after sending headers
> eg:
>
> header("Content-type: text/plain");
> header("Content-Disposition: attachment; filename=downloaded.txt");
> readfile("downloaded.txt");
> exit();
>
> The downloaded.txt can be any file subject to sending the correct
> headers and IE
> and other browsers will pop up a download (save) window.
>
> See your mime.types file for headers for each file type.
>
>
> Timothy Hitchens (HiTCHO)
> Open Source Consulting
> e-mail: [EMAIL PROTECTED]
>
> > -Original Message-
> > From: Shaun van den Berg [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, 21 January 2003 4:39 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] DOWNLOAD
> >
> >
> > Hi ,
> >
> > Im not sure if this can be done in PHP , i know PHP has
> > upload features ! Does it have download features , wat i mean
> > is the following : i want a link - click here to download -
> > when you click on it , the download dialog box must appear -
> > how do i do this ?
> >
> > Thanks
> > Shaun van den Berg
> >
> > --
> > Novtel Consulting
> > Tel: +27 21 9822373
> > Fax: +27 21 9815846
> > Please visit our website:
> > www.novtel.co.za
> >
> >
> >
> > --
> > 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
>
>





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




Re: [PHP] Detecting posts from outside site

2003-01-21 Thread Jim Lucas
what about checking the checking the remote ip address?

Jim
- Original Message - 
From: "Chris Shiflett" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, January 21, 2003 10:45 AM
Subject: Re: [PHP] Detecting posts from outside site


> --- [EMAIL PROTECTED] wrote:
> > If it's bulletproof, then I figured this could help
> > some of you out. If not, I welcome comments (I'm a
> > little bit hesitant of calling things 'bulletproof').
> 
> It's not bulletproof. :-)
> 
> > if((count($_POST) > 0) &&
> > (!stristr($_SERVER["HTTP_REFERER"],
> > $http_referer))) {
> > unset($_POST);
> > $evil = "postedfromoutsidepage";
> > }
> 
> If this page is located at http://www.example.org/foo.php,
> and you are trying to ensure that the data is being posted
> from http://www.example.org/bar.php consider the following:
> 
> 
> # telnet www.example.org 80
> Trying 192.0.34.166...
> Connected to www.example.org (192.0.34.166).
> Escape character is '^]'.
> POST /foobar.php HTTP/1.1
> Host: www.example.org
> Referer: http://www.example.org/bar.php
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 26
> 
> varname=any_value_i_choose
> 
> 
> Someone can use this method to bypass your Referer header
> check and post any data they choose.
> 
> 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




[PHP] Quick Question about Template Parsers

2003-01-22 Thread Jim Lucas
In general, how do most template parsers work?

do they read the file into a variable and do something 
to the effect of preg_replace() to element that is found?

and if so, could you replace the step of reading the file 
into a variable with getting the template data out of a database?

WARNING... more questions to come...

Jim



Re: [PHP] Select value for driopdown box

2003-01-22 Thread Jim Lucas
function DrawOptions($options, $active='')
{
  $str = '';
  foreach($options AS $key=>$value)
  {
$sel = ($active==$key?" SELECTED":"");
$str .= "".$value."\n";
  }
  return($str);
}

Try this





array needs to be a key-value pair that has the value that you are looking
for as the key and if it matches it will make that key - value assoc the
selected one.

that should work for you

- Original Message -
From: "Ben C." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 22, 2003 10:14 AM
Subject: [PHP] Select value for driopdown box


> I am using the query below to edit a record. I want to edit the field
which has a list of states in a dropdown box.   I want to have the state
that is in the selected field shown as the selected state.  How would I do
this?
>
>
> Query
> -
>  $sql = "SELECT *
> FROM $table_name
> WHERE buyerid = \"$buyerid\"
> ";
>
> $result = @mysql_query($sql,$connection) or die(mysql_error());
>
>
> while ($row = mysql_fetch_array($result)) {
>  $buyerid = $row['buyerid'];
>  $state = $row['state'];
>
> $option_block .= "$state";
> }
>
> $display_block = "
>
> 
> $option_block
> 
> ?>
>
> 
> State
> 
> 
>
> 
>
>
> --
> 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




Re: [PHP] Reading Directory in reverse

2003-01-22 Thread Jim Lucas
is it on a unix system?

if so, do an ls on the system and you will see that the files are listed in
that order.

it is the order in which they were copied to the directory.

try going through a loop before you run your main loop, create an array()
then sort that with some sorting functions and you'll have it.

Jim
- Original Message -
From: "Bob Irwin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 22, 2003 3:03 PM
Subject: [PHP] Reading Directory in reverse


> Hi Guys,
>
> Does anyone happen to know why the below code reads the directory in
reverse
> alphabetical order?  Not a major problem - easy enough to whack it in an
> array and sort it, but annoying nonetheless.
>
>
> $default_dir = "../screenshots";
>
> if (!($dp = opendir($default_dir))) die("cannot open $default_dir");
> while($file = readdir($dp))
> if($file != '.' && $file != '..') echo" href='opendir.php?opendir=$file'>$file";
> closedir($dp);
>
> Best Regards
> Bob Irwin
> Server Admin & Web Programmer
> Planet Netcom
>
>
> --
> 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




Re: [PHP] a simple getenv question....

2003-01-22 Thread Jim Lucas
just copied your code and it worked fine for me.

system: Apache 1.3.26
PHP 4.2.2

I would look into apache 2.0 and the env vars that are available from it.


- Original Message -
From: "Bruce Douglas" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 22, 2003 3:57 PM
Subject: [PHP] a simple getenv question


> Hi...
>
> A simple question... In the following code:
>
> 
> $ip = getenv("REMOTE_ADDR");
>
> echo " ip = ".$ip;
>
> echo " ip = " . getenv("REMOTE_ADDR");
>
> echo " ip = " . getenv('REMOTE_ADDR');
>
> echo " ip = ". $REMOTE_ADDR; <--
>
> ?>
>
> I can only seem to get the last line to display the correct value. It's as
> if I can't seem to get/return any of the SERVER environment variables
using
> the getenv() function
>
> I'm using Apache 2.0.40, PHP 4.2.2 on Linux RedHat 8.0.
>
> I've checked through the PHP.INI file, but couldn't seem to find why this
> might be occuring. Any help/assistance would be appreciated.
>
> thanks
>
> bruce
> [EMAIL PROTECTED]
>
>
>
> --
> 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




Re: [PHP] total file size

2003-01-23 Thread Jim Lucas
yes, it is possible, but not with php.

Jim

- Original Message - 
From: "Victor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 22, 2003 8:10 PM
Subject: [PHP] total file size


> Is there a way to find out total upload file size from a file uploaded
> though an html form? I figure if I know the total size, then I can just
> consistently poke at the file being uploaded and math a progress bar for
> the file being uploaded, of course, this all hangs upon the ability of
> getting the total file size BEFORE it is uploaded. It IS possible I have
> seen it done with JSP; anybody can help me with this? Thanks
> 
> - Vic
> 
> __ 
> 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
> 
> 



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




Re: [PHP] why is mv copying ??

2003-01-24 Thread Jim Lucas
I am guessing that apache isn't the owner of the file.  therefor it can't
delete it from it original position.

mv in unix basically copies the file pointer from one place and to another
place.

then deletes the original pointer.  if you don't have permission to delete
the file from its original point, then you can't do an mv command
successfully.

Check your permissions on the original file, find out if apache is the
owner.  that will tell you if you can delete the file.

Jim

- Original Message -
From: "Christian" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 23, 2003 5:01 PM
Subject: [PHP] why is mv copying ??


> Hi all,
>
> Any idea why when I execute 'mv' in a php script
> the file is copied not moved?
>
> Apache is a member of the group which owns the file
> and has wrx permissions.
>
> Thanx,
> Christian
>
>
> --
> 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




Re: [PHP] help me

2003-01-24 Thread Jim Lucas
the only difference to structure is this line is in the first file and not
the second.

fw_menu_2.addMenuItem("STANDARD
PROMOTION","location='http://www.bis.org.in/sf/sfp2.htm'");

diff is a wonderful tool!!!

Enjoy

Jim

- Original Message -
From: "Amit Gupta" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 23, 2003 9:21 PM
Subject: [PHP] help me



Hi,

How are you?

My friends following are two javascript files for pop-up menus. menu2.js is
working satisfactorily while menu.js is not working. I tried lot to trace
the loophole but all in vain. kindly compare the two files and help me.

menu2.js
function fwLoadMenus() {

if (window.fw_menu_0) return;

window.fw_menu_1_1 = new
Menu("DIRECTORY",130,17,"Arial",10,"#003300","#cc","#cc9966","#00");

fw_menu_1_1.addMenuItem("HEADQUATER","location='http://www.bis.org.in/dir/hq
.htm'");

fw_menu_1_1.fontWeight="bold";

fw_menu_1_1.hideOnMouseOut=true;

window.fw_menu_1 = new
Menu("root",213,17,"Helvetica",10,"#003300","#cc","#cc9966","#00");

fw_menu_1.addMenuItem(fw_menu_1_1);

fw_menu_1.fontWeight="bold";

fw_menu_1.hideOnMouseOut=true;


window.fw_menu_2 = new
Menu("root",208,0,"sans-serif",10,"#003300","#cc","#cc9966","#00");

fw_menu_2.addMenuItem("STANDARD
PROMOTION","location='http://www.bis.org.in/sf/sfp2.htm'");

fw_menu_2.fontWeight="bold";

fw_menu_2.hideOnMouseOut=true;


window.fw_menu_3 = new
Menu("root",208,17,"Helvetica",10,"#003300","#cc","#cc9966","#00");

fw_menu_3.addMenuItem("STANDARD
PROMOTION","location='http://www.bis.org.in/sf/sfp2.htm'");

fw_menu_3.fontWeight="bold";

fw_menu_3.hideOnMouseOut=true;


fw_menu_3.writeMenus();}

menu.js
function fwLoadMenus() {

if (window.fw_menu_0) return;

window.fw_menu_1 = new Menu("root",213,17,"Verdana, Arial, Helvetica,
sans-serif",11,"#003300","#cc","#cc9966","#00");

window.fw_menu_1_1 = new Menu("",213,17,"Verdana, Arial, Helvetica,
sans-serif",11,"#003300","#cc","#cc9966","#00");

fw_menu_1_1.addMenuItem("u","location='http://www.bi2s.org.in/other/iscd.htm
'");

fw_menu_1_1.fontWeight="bold";

fw_menu_1_1.hideOnMouseOut=true;

fw_menu_1.addMenuItem(fw_menu_1_1);

fw_menu_1.fontWeight="bold";

fw_menu_1.hideOnMouseOut=true;

window.fw_menu_2 = new
Menu("root",208,17,"Helvetica",10,"#003300","#cc","#cc9966","#00");

fw_menu_2.fontWeight="bold";

fw_menu_2.hideOnMouseOut=true;

window.fw_menu_3 = new Menu("root",213,17,"Verdana, Arial, Helvetica,
sans-serif",11,"#003300","#cc","#cc9966","#00");

fw_menu_3.addMenuItem("","location='
http://www.bi3s.org.in/other/iscd.htm'");

fw_menu_3.fontWeight="bold";

fw_menu_3.hideOnMouseOut=true;

fw_menu_3.writeMenus();

}


Keep smiling. It cost nothing but gives everything.

Yours

Amit Gupta





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




Re: [PHP] Form Variables not getting passed || Apache, MySql, Win 2k Setup

2003-01-29 Thread Jim Lucas
then run extract($_REQUEST);  just above where you want to use the var1
var2...  and it will place all the key => value pairs into the local scope.

Jim
- Original Message -
From: "Noah" <[EMAIL PROTECTED]>
To: "Philip Olson" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, January 29, 2003 5:55 PM
Subject: Re: [PHP] Form Variables not getting passed || Apache, MySql, Win
2k Setup


> I don't want to use $_REQUEST['my_passed_variable'] at all.
>
> Right now when I do an sql insert on my local machine I have to use the
> following syntax:
>
> INSERT into tablename (field name list)
> VALUES ($_REQUEST['var1'],  $_REQUEST['var2'], $_REQUEST['var3'])
>
> I just want to use $var1, $var2, $var3
>
> --Noah
>
> - Original Message -
> From: "Philip Olson" <[EMAIL PROTECTED]>
> To: "CF High" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, January 29, 2003 2:23 PM
> Subject: Re: [PHP] Form Variables not getting passed || Apache, MySql, Win
> 2k Setup
>
>
> >
> > One too many $'s in your code, use:
> >
> > $_REQUEST['my_passed_variable']
> >
> > This is how all arrays work, autoglobals are the same.
> > See also:
> >
> > http://www.php.net/variables.external
> > http://www.php.net/variables.predefined
> >
> > Regards,
> > Philip
> >
> > On Wed, 29 Jan 2003, CF High wrote:
> >
> > > Hey all.
> > >
> > > This driving me nuts:
> > >
> > > I've got Apache, MySql, and Windows 2000 running on my local
> machine.
> > > In order to get passed php variables evaluated, whether via a url
query
> > > string, or through a form post, I have to use this syntax:
> > >
> > > $_REQUEST[$my_passed_variable]
> > >
> > > I have no such problem with our hosting company servers; i.e. I can
> access
> > > query_string and form posted variables as $my_passed_variable.
> > >
> > > What is going on here? Is there something in php.ini that needs to be
> > > adjusted?
> > >
> > > Any help whatsoever here is much appreciated,
> > >
> > > --Noah
> > >
> > > --
> > >
> > >
> > >
> > >
> > > --
> > > 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
>
>



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




Re: [PHP] Form Variables not getting passed || Apache, MySql, Win 2k Setup

2003-01-29 Thread Jim Lucas
why would it matter if he does it just above the place that he is going to
use them?

doesn't matter if he is in a function or not.  the $_REQUEST var will always
be available.

if he calls a function then he would have to do it just inside the function
or pass it to the function.

Jim
- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 29, 2003 2:59 PM
Subject: Re: [PHP] Form Variables not getting passed || Apache, MySql, Win
2k Setup


> On Thursday 30 January 2003 09:55, Noah wrote:
> > I don't want to use $_REQUEST['my_passed_variable'] at all.
> >
> > Right now when I do an sql insert on my local machine I have to use the
> > following syntax:
> >
> > INSERT into tablename (field name list)
> > VALUES ($_REQUEST['var1'],  $_REQUEST['var2'], $_REQUEST['var3'])
> >
> > I just want to use $var1, $var2, $var3
>
> Are you trying to use these inside a function? If so, look up variable
scope
> in the manual.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Most people have a mind that's open by appointment only.
> */
>
>
> --
> 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




Re: [PHP] Backticks and echo

2003-02-19 Thread Jim Lucas
you could always to a preg_replace() and replace the backticks with their
&#xxx; equal.

Jim
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 19, 2003 4:27 AM
Subject: [PHP] Backticks and echo


> Hello everyone
>
> I reread the manual again on the topic of backticks and from that I have
> security / usabilitiy issue.
>
> Here is the issue:
>
> When I check formdata from a simple form I use regular expression to make
> sure the input confirms to certain guidlines before including them into my
> scripts.
> Basically this means excluding special character like the above mentioned
> backticks. Well so far so good.
> When the input is wrong I'd like to redisplay the wrong input and ask the
> user to correct these.
> Now here comes the issue as far as I understand the manual the text
> inbetween backticks is executed and the output is included in place. This
> happens when I echo the text out. So if I don't allow backticks in my
> input field and I want to redisplay that input I execute the code right?
> Meaning I can'T redisplay the text as the user inputed it. When I use
> escapeshellcmd  to prevent any execution I redisplay the input differently
> than the users input. This will confuse most users and is not as wished
> from a usability standpoint.
> So have I missunderstood the way backticks work or is this an unresolvable
> issue?
>
> Any help greatly appreciated
>
> Stefan



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




Re: [PHP] Cannot find php.ini

2003-02-21 Thread Jim Lucas
the default location for the php.ini file (if installed with the RPM's) is
/etc/php.ini

Jim
- Original Message -
From: "Kevin Paz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 21, 2003 11:03 AM
Subject: [PHP] Cannot find php.ini


>
> I've taken over a redhat server with apache/php4.1.  I need to enable
> register_argc_argv but I can't find the php.ini file (I've searched the
> entire system).
>
> Would creating a new php.ini file with only register_argc_argv line work?
> Where's the default location for php.ini?
>
>
> Thanks in advance,
>
> Kevin
>
>
>
> --
> 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



Re: [PHP] What do these errors mean?

2003-02-21 Thread Jim Lucas
in the first line of the code you are refering to $_GET[option]

option in this case is being seen as a constant.

if you were to put single or double quotes it would work.

the second notice means that in the $_GET array, there isn't a key called
option

it would probably work better if you did this.

if(empty($_GET['option'])) {
  your code here
}


- Original Message -
From: "Tyler Longren" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 21, 2003 11:01 AM
Subject: [PHP] What do these errors mean?


> Hi,
>
> I was looking through php.ini and noticed that show_error was set to Off.
I
> turned it On, and now I see these errors on one of my pages:
> Notice: Use of undefined constant option - assumed 'option' in
> /usr/local/apache/htdocs/tyler/encodeDecode.php on line 37
>
> Notice: Undefined index: option in
> /usr/local/apache/htdocs/tyler/encodeDecode.php on line 37
>
> Here's line 37-42:
> if ($_GET[option] == "") {
>  print "Add Credit Card";
>  print "
>  Credit Card Number:  name=cc>
>  ";
> }
>
> What's wrong with that?
>
> Thanks,
> Tyler
>
>
> --
> 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



Re: [PHP] deciperhing oop

2003-03-03 Thread Jim Lucas
the second argument in the mysql_select_db call in not in scope.

you should be using $this->db instead of $db

Jim
- Original Message -
From: "Larry Brown" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Monday, March 03, 2003 2:52 PM
Subject: [PHP] deciperhing oop


> Can someone who is used to using php oop help me figure out why this
fails?
> I know there are probably a thousand classes already designed to do this
and
> probably 100 times more efficient, but this is how I learn.  From what
I've
> read this should work but there is obviously something I'm missing.
>
> Quick problem description:
> Trying to set up class to connect to mysql db.  Already used a procedural
> test successfully connecting to db.  Error is displayed as...
>
> Warning: mysql_select_db(): supplied argument is not a valid MySQL - Link
> resource in /var/www/html/oop.php on line 67
> Database Selection to main failed.
>
> Code:
>
> Class dbConnect
> {
> var $machine;
> var $port;
> var $user;
> var $password;
> var $query;
> var $result;
> var $dbase;
> var $db;
> var $sel;
>
> function dbConnect($machine,$port,$user,$password)
> {
> $this->machine = $machine;
> $this->port = $port;
> $this->user = $user;
> $this->password = $password;
>
> $db = mysql_pconnect ("$machine","$user","$password")
> if (!$db)
> {
> die ("Initial connection to DB failed.")
> }
> $this->db = $db;
> }
> function setDbase($dbase)
> {
> $this->dbase = $dbase;
>
> $sel = mysql_select_db("$dbase",$db);
> if(!$db)
> {
> die ("Database Selection to $dbase failed.");
> }
> }
> }
>
> $dbn = new dbConnect("localhost","3306","bob","hjhyt4kl5");
>
> $dbn->setDbase("main");
>
>
>
>
>
>
> So why can't I use $db?  Isn't the statement $this->db=$db making it
> available to the setDbase function?
>
> Larry S. Brown
> Dimension Networks, Inc.
> (727) 723-8388
>
>
>
>
> --
> 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



Re: [PHP] File Download

2003-03-06 Thread Jim Lucas
have the file download in a popup window.

after the down load the window will be gone.

Then you don't have to worry about the refreshing of the main window.

Jim
- Original Message -
From: "David Miller" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 06, 2003 8:30 AM
Subject: [PHP] File Download


> Hello
>
> I have a script that after login gives the user access to one directory.
The
> directory depends on their login.
>
> After login a list of files is displayed with a check box in front of each
file.
> Under the list of files there are several buttons, Copy, Delete, Rename,
Upload, and
> Download.  When you check a box, and select a a button, lets say copy, you
are given
> a new window to enter the new name.  Once entered and you select continue
the a copy
> is made and the list of files is refreshed, displaying also the new file.
All the
> buttons function this way except the download which is where I have
problems.
>
> I a file management class I have a function for each operation.  The code
for the
> download function is as follows:
>
>  function downloadFile($filename)
> {
> $result = "";
> if(file_exists($this->_memberDir . "/" . $filename))
> {
> header("Content-type: application/octet-stream");
> header("Content-Disposition: attachment; filename=$filename");
>  header("Pragma: no-cache");
> if (!readfile($this->_memberDir . "/" . $filename))
> $result = $filename . " successfully downloaded";
> }
> else
> {
> $result = "Download Failed for " . $filename . ", does not exist";
> }
> return $result;
> }
>
>
> When this function runs, I get the download box that allows the user to
select where
> they want to save there file and a file gets saved.  After this code
returns the
> $result should be printed at the top of the browser window and the list of
files
> displayed again.  What happens is the results and the list of files, the
html code
> for the next screen, is appended to the end of the file that was
downloaded.  I can
> put an exit() inplace of return and I get the correct file size downloaded
but I
> still don't get my screen refreshed.  I would think that I should be able
to put
> another header statement after the download to indicate the no more data
goes into
> the file but is to be displayed by the browser.  I can't figure out how to
get this
> to work.
>
> Thanks
>
> David Miller
>
>
>
> --
> 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



Re: [PHP] javascript

2003-03-07 Thread Jim Lucas
Plus, what if their was a textarea that you can't reload from the process
page
because the amount of data was greater then the max limit of the GET
protocol?

Then you would loose all that data.


- Original Message -
From: "David Miller" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 07, 2003 7:40 AM
Subject: Re: [PHP] javascript


You might be checking it 6 or 8 times if the user can't get all the fields
filled in
correctly.  Creates a lot of traffic that isn't necessary between server and
client.
If javascript isn't enabled, there isn't a choice but if it is then the
client side
can prompt the 6 or 8 times until the user gets it correct.

Cranky Kong wrote:
> Yes but if the fields are well filled, you will check all 2 times, the
first
> time on the client side to know that the fields are filled.
> And a second time on server side to check the data before inserting them
in
> a DB for examples...
> So why make 2 tests, if only one is good.
>
> The reloading of the page is very fast.
>
>
> "Marek Kilimajer" <[EMAIL PROTECTED]> a écrit dans le message de news:
> [EMAIL PROTECTED]
> If the user is disabled, the user will be bothered to wait till the page
> reloads, sure there MUST be server side check
>
> Cranky Kong wrote:
>
>
>>And what are you doing if the javascript is not enabled in the browser of
>>the client ???
>>There will be no verification and the user can enter what he want in the
>>field of your form
>>And it's a bit dangerous for your DB if your insert data in a DB...
>>
>>
>>"Marek Kilimajer" <[EMAIL PROTECTED]> a écrit dans le message de news:
>>[EMAIL PROTECTED]
>>
>>
>>
>>>Not bothering the user to wait till the next page loads
>>>
>>>Liam Gibbs wrote:
>>>
>>>
>>>
>>>
>If you want to validate form data before sending it, javascript is the
>choise.
>
>
>
>

Yeah, before sending it. Just wondering what the advantage is in


>>
>>validating
>>
>>
>>
before sending.






>>
>>
>>
>>
>>
>
>


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



Re: [PHP] Dollar signs in values

2003-03-07 Thread Jim Lucas
How are you including the file in question?

Jim
- Original Message -
From: "Liam Gibbs" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Thursday, March 06, 2003 9:58 PM
Subject: [PHP] Dollar signs in values


How is it I can properly get PHP to represent dollar signs when putting it
into HTML?

I know that dollar signs denote the beginning of a variable, like $reference
or $ftpstream or whatever. However, I have a text file that contains (or can
contain) values with $ in them. When I open the file and grab those values,
then stick them onto my HTML page, they get unpredictable results. Is there
a way I can escape them or such?




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



Re: [PHP] MySQL Alias and PHP

2003-03-07 Thread Jim Lucas
Then the information in the DB is the same.

Jim
- Original Message - 
From: "Charles Kline" <[EMAIL PROTECTED]>
To: "Rich Gray" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, March 07, 2003 10:03 AM
Subject: Re: [PHP] MySQL Alias and PHP


Thanks for the help. Almost there. Here is what I have:

SELECT x.id, x.headline, x.description, a.area area_a, b.area area_b
FROM tbl_funding x, tbl_dra a, tbl_dra b
GROUP  BY x.id LIMIT 0 , 30

The problem is that $array[area_a] and $array[area_b] display the same 
info.





On Friday, March 7, 2003, at 11:09 AM, Rich Gray wrote:

>> Hi all,
>>
>> I have this query:
>>
>> SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
>> WHERE x.area_1 = a.id
>> AND x.area_2 = b.id
>>
>> I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo
>> the values for a.id and b.id?
>>
>> Thnks
>> Charles
>>
>
> I presume you mean area_name...
>
> Try this -> SELECT a.area_name as area_a, b.area_name as area_b FROM 
> tbl_1
> x, tbl_2 a, tbl_2 b
> Then you can refer to the columns as $array['area_a'] and 
> $array['area_b']
>
> HTH
> Rich
>


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



Re: [PHP] Min and max of array

2003-03-07 Thread Jim Lucas
make a copy of the original array and sort that, when you find it correct
key, use that to refer to the correct value in the original array.

Jim
- Original Message -
From: "Liam Gibbs" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Friday, March 07, 2003 11:24 AM
Subject: Re: [PHP] Min and max of array


> >you can sort it and get the values.
>
> I would, but I need the array in the same order. I can't sort it.
>
>
> --
> 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



Re: [PHP] header function

2003-03-07 Thread Jim Lucas
if you put this at the very to of the page, I am guessing
then that you haven't ran session_start()  ??

if you are trying to access a value stored in a session variable, you need
to initialize the session first, then access the variable.

Jim
- Original Message -
From: "Barry Gould" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 07, 2003 3:35 PM
Subject: [PHP] header function


> I am having a hard time with the header("Location:") function inside an
> include file with PHP 4.3.1 (Linux, running as a module w/ Apache 1.3.27).
>
> At the VERY TOP of my php page, I have:
> 
>
> logincheck.php contains exactly:
>  // login check
> if(!isset($_SESSION["agent_id"]))
> {
> header("Location:/");
> header("Connection: close");
> exit;
> }
> ?>
>
> However, if this "agent_id" is not set, I just get a blank page with html
> open and close tags.
>
> I'm SURE there are no spaces or blank lines before these lines.
>
> It works fine if I put the code in the main page instead of using the
> virtual include.
>
> Output buffering is set to 4096 in php.ini.
>
> Any suggestions would be appreciated.
>
> Thanks,
> Barry
>
>
> --
> 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



Re: [PHP] $PHPSESSID

2003-03-08 Thread Jim Lucas
I think it might have something to do with --enable-trans-sid

read up on that

Jim
- Original Message -
From: "Liam Gibbs" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Friday, March 07, 2003 8:45 PM
Subject: [PHP] $PHPSESSID


First of all, thanks all who helped with the min and max functions (that
works) and the dollar sign bit (which also works). Kudos. Couldn't have done
it without y'all!

Here's the newest brain teaser: I have cookies disabled (well, I have IE set
to the highest security mode, where it disables cookies). I understand that
with cookies enabled, $PHPSESSID will return nothing when it works. However,
it will return a value when cookies are disabled and the page is refreshed
after a cookie is attempted. I'm still getting nothing either way. Anybody
know why?




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



Re: [PHP] file_exists() question

2003-03-08 Thread Jim Lucas
what does $annrow[id] return?

I HAVE found that I have to refer to a file when using file_exists() from /

so
file_exists("/path/to/me/cherpdocs/filename.doc")

for it to work right.

Jim
- Original Message - 
From: "Charles Kline" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 08, 2003 1:10 PM
Subject: [PHP] file_exists() question


> Can anyone tell me why this code does not return true when the file in 
> the directory cherpdocs/ with the file (which I see as being there) 
> does exist?
> 
> if(file_exists('cherpdocs/$annrow[id].doc')){
>  echo "Funding 
> details paper";
>   }
> 
> This is a path relative to the file calling it, should it be otherwise?
> 
> Thanks
> Charles
> 
> 
> -- 
> 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



Re: [PHP] Array - Newbie question

2003-03-08 Thread Jim Lucas
You need to have this

$EricCodesArray = array (
 "CO" => array("Description",
   "Input Name",
   "Select Name",
   "Option Name",
   "Option Selected"),
 "AN" => array("ERIC Number",
   "EricAN",
   "SelAN",
   "AN",
   "AN «Annotation»"),
 "TI" => array("Title",
   "EricTI",
   "SelTI",
   "BT",
   "BT «Book Title»")
 );

you must place the 5 elements in a sub array

Jim

- Original Message -
From: "John Taylor-Johnston" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 08, 2003 4:47 PM
Subject: [PHP] Array - Newbie question


> New at this, somewhat:
>
>  #http://www.php.net/manual/en/ref.array.php
> $EricCodesArray = array (
> "CO" => "Description", "Input Name", "Select Name", "Option Name",
"Option Selected",
> "AN" => "ERIC Number", "EricAN", "SelAN", "AN", "AN «Annotation»",
> "TI" => "Title", "EricTI", "SelTI", "BT", "BT «Book Title»"
> );
>
> echo $EricCodesArray=>TI[2]; //should display "SelTi"
>
> ?>
>
> I want to display "SelTi". How to code for it? I know I should know this.
> EricCodesArray where TI = [2]
>
> ? :)
> John
>
>
> --
> 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



Re: [PHP] ob_start -- output buffer problem

2003-03-10 Thread Jim Lucas
because the flush happens after everything is done, including the fputs
thingy.

you have to call ob_get_contents() or something like that.

I always to this

ob_start();

do something

$data = ob_get_contents();
ob_end_clean();

then I work with the $data later.

but if you don't use the ob_get_contents(); or ob_end_clean();  then PHP
waits until everything is done, and then flushes.

Jim
- Original Message -
From: "Alex Lance" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 09, 2003 2:22 AM
Subject: [PHP] ob_start -- output buffer problem


>
> Hi all,
>
> to quote from http://www.php.net/manual/en/function.ob-start.php
>
> > void ob_start ( [string output_callback])
> >
> > An optional output_callback function may be specified. This function
> > takes a string as a parameter and should return a string. The function
> > will be called when  ob_end_flush() is called, or when the output
> > buffer is flushed to the browser at the end of the request.
>
> My callback function does not get called unless I manually call
> ob_end_flush().
>
> I'm not interested in calling ob_end_flush() at all,  I want my callback
> function to be called "when the output buffer is flushed to the browser
> at the end of the request" so the question is why isn't this happening?
>
> here's my example:
>
> 
> $x = new test();
>
> echo "hey";
>
> // IF next line is uncommented so it manually flushes
> // then the finish method WILL get called. But I need
> // get around calling anything at the *end* of a script.
>
> //ob_end_flush();
>
>
> class test {
>
> var $msg_file = "cooked_html/error_log2";
>
> function test() {
> ob_start(array(&$this, "finish"));
> $this->msg("got to initialize");
> }
>
> function finish($page) {
> $this->msg("GOT TO FINISH!!!");
> return $page;
> }
>
> function msg ($msg) {
> $msg = "\n" . exec("date") ." ::: ". $msg;
> $fp = fopen($this->msg_file, "a") or die ("cannot open
".$this->msg_file);
> fputs ($fp, $msg, strlen($msg)) or die ("cannot write to
".$this->msg_file);
> fclose($fp);
> }
>
> }
>
> ?>
>
>
> But if ob_end_flush() IS called then the error log WILL have the "GOT TO
> FINISH" message.
>
> Any ideas on why the output is not being flushed automatically?
> thanks
> Alex
>
>
>
>
> --
> 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



Re: [PHP] php-general as REPLY TO

2003-07-01 Thread Jim Lucas
You could signup with a company like yahoo.com or hotmail or bend.com and
you could then have a web based email service.

You ALWAYS have choices...  :)

Jim Lucas
- Original Message -
From: "Ford, Mike [LSS]" <[EMAIL PROTECTED]>
To: "'Derick Rethans'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, July 01, 2003 3:08 AM
Subject: RE: [PHP] php-general as REPLY TO


> > -Original Message-
> > From: Derick Rethans [mailto:[EMAIL PROTECTED]
> > Sent: 30 June 2003 22:47
> >
> > On Mon, 30 Jun 2003, Doug Essinger-Hileman wrote:
> >
> > > Having said this, I suspect that you and I will continue to
> > disagree,
> > > which is perfectly okay. If this list changes the default I will be
> > > happy. If it doesn't, I will learn to adjust. One request I make is
> > > that folk, including you, Derick, refrain from sending
> > replies to my
> > > email to both the list *and* my personal inbox. There's no need to
> > > waste the bandwidth.
> >
> > You'll have to learn to adjust then I guess. And do those 2k really
> > matter? Come on...  Just get a good mailer that defaults to
> > "Reply-All"
> > (like, mutt, pine, pcpine)
>
> Some of us don't have the choice -- we work in a corporate or
institutional environment where the decision is made centrally.  (Hence M$
Outlook 98 here!!!)
>
> Cheers!
>
> Mike
>
> -
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
>
> --
> 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



Re: [PHP] Using INCLUDES in SAFE MODE

2003-07-02 Thread Jim Lucas
if you are on a linux system, you could always symlink the folders into the
public_html dir.

Jim Lucas
- Original Message -
From: "MIKE YRABEDRA" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 5:36 AM
Subject: [PHP] Using INCLUDES in SAFE MODE


>
>
> I currently have all my users in safe-mode to prevent them from running
> shell commands via php.
>
> I would still like for them to be able to access certain folders (i.e.
PEAR,
> basic_functions, etc..) that reside out of their root.
>
> Since safe_mode prevents this, is there a way in the domain's config, to
> allow access to *specific* directories when in safe_mode?
>
>
> TIA
>
>
>
> ++
> Mike Yrabedra (President)
> 323 Incorporated
> Home of MacDock, MacAgent and MacSurfshop
> ++
> W: http://www.323inc.com/
> P: 770.382.1195
> F: 734.448.5164
> E: [EMAIL PROTECTED]
> I: ichatmacdock
> ++
> "Whatever you do, work at it with all your heart,
> as working for the Lord, not for men."
> ~Colossians 3:23 <{{{><
> ++
>
>
>
> --
> 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



Re: [PHP] outputting xml declaration

2003-07-02 Thread Jim Lucas
try this

print "<\?xml version=\"1.0\"\?>";


This might fix it.

- Original Message - 
From: "Steven Apostolou" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 6:33 AM
Subject: [PHP] outputting xml declaration


> Hello,
> 
> The folowing code gives an error:
> 
> print "";
> 
> This is probably because I print a questionmark? How can I avoid that an
> error is generated?
> 
> Besides it's not an error in the way that it gives an errorstring but it
> writes the output in the error_log of apache...
> 
> Greetings,
> 
> -- 
> Steven Apostolou <[EMAIL PROTECTED]>
> 
> 
> -- 
> 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



Re: [PHP] print html code

2003-07-02 Thread Jim Lucas
You could always use  at the top of the screen.

Jim Lucas
- Original Message -
From: "Wendell Brown" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Karina S" <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 11:27 AM
Subject: Re: [PHP] print html code


> On Wed, 2 Jul 2003 19:40:37 +0200, Karina S wrote:
>
> >I want to make a php site which can generate a html code and display it
on
> >the screen. (Display the code itself.)
>
> See if this will do what you want:
>
> > http://us2.php.net/manual/en/function.highlight-string.php
>
> or
>
> > http://us2.php.net/manual/en/function.highlight-file.php
>
>
> --
> 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



Re: [PHP] print html code

2003-07-02 Thread Jim Lucas
So what, it would do what was requested.  :)

Jim Lucas
- Original Message -
From: "Leif K-Brooks" <[EMAIL PROTECTED]>
To: "Jim Lucas" <[EMAIL PROTECTED]>
Cc: "Wendell Brown" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; "Karina
S" <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 12:30 PM
Subject: Re: [PHP] print html code


> Jim Lucas wrote:
>
> >You could always use  at the top of the screen.
> >
> And violate every single HTML standard.  AFAIK,  was never a
> real tag.
>
> --
> The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>
>
> --
> 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



Re: [PHP] print html code

2003-07-02 Thread Jim Lucas
well, tell me.  What browser follows the standards 100% ??
- Original Message -
From: "Leif K-Brooks" <[EMAIL PROTECTED]>
To: "Jim Lucas" <[EMAIL PROTECTED]>
Cc: "Wendell Brown" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; "Karina
S" <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 12:57 PM
Subject: Re: [PHP] print html code


> In browsers that refuse to follow standards, maybe.  Breaking standards
> is a bad thing.
> Jim Lucas wrote:
>
> >So what, it would do what was requested.  :)
> >
>
> --
> The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>
>
> --
> 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



Re: [PHP] Break, Exit, Die, Kill, Maime and Stab

2003-07-02 Thread Jim Lucas
return;

will do the trick

Jim Lucas
- Original Message - 
From: "Jonathan Pitcher" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 2:09 PM
Subject: [PHP] Break, Exit, Die, Kill, Maime and Stab


> I have some scripting that includes files.  The included files are 
> executed and everything works great.
> 
> The included page needs to check multiple information.
> 
> Currently if I want the scripts to end correctly I have to:
> 
> 
> if ()
> {
> }
> else
> {
> if ()
> {
> }
> else if ()
> {
> }
> }
> 
> You get the picture.  Code gets hard to read with so many If's and 
> Elses.
> 
> I would love to:
> 
> if()
> {
> //Blah
> break;
> }
> 
> and have that break only stop the rest of the execution of the include 
> file but allow the script that included it to finish running.
> 
> I have tried break, exit and die with no luck.  Even tried break 1; and 
> break 2; to break out of levels but that didn't seem to work either.
> 
> Is there a solution or should I continue to do what I have done.
> 
> Thanks in advance,
> 
> Jonathan Pitcher
> 
> 
> -- 
> 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



Re: [PHP] Need a function to calculate time difference.

2003-07-02 Thread Jim Lucas
what type of format does your column take?

date
time
datetime

??

Jim Lucas
- Original Message - 
From: "Jack Sasportas" <[EMAIL PROTECTED]>
To: "php" <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 2:11 PM
Subject: [PHP] Need a function to calculate time difference.


> I am trying to find a function or information on how to properly take a 
> start time and an end time from mysql timestamps in order to calculate 
> time taken.
> So in theory $endtime-$starttime = timespent.
> 
> It would be great if this understood that 11:55 pm til 12:10am one day 
> apart only equals 15 minutes.
> 
> Links, example code etc would be great!
> 
> Thanks
> 
> 
> -- 
> 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



Re: [PHP] Break, Exit, Die, Kill, Maime and Stab

2003-07-02 Thread Jim Lucas
Technically you are not outside of a function.

you need to use one of the include or require functions to include the file
right?

Jim Lucas
- Original Message -
From: "Jonathan Pitcher" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 2:30 PM
Subject: Re: [PHP] Break, Exit, Die, Kill, Maime and Stab


> return will work outside of functions ??
>
> That I didn't know.
>
> Thanks,
>
> Jonathan
>
> On Wednesday, July 2, 2003, at 04:28  PM, Jim Lucas wrote:
>
> > return;
> >
> > will do the trick
> >
> > Jim Lucas
> > - Original Message -
> > From: "Jonathan Pitcher" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, July 02, 2003 2:09 PM
> > Subject: [PHP] Break, Exit, Die, Kill, Maime and Stab
> >
> >
> >> I have some scripting that includes files.  The included files are
> >> executed and everything works great.
> >>
> >> The included page needs to check multiple information.
> >>
> >> Currently if I want the scripts to end correctly I have to:
> >>
> >>
> >> if ()
> >> {
> >> }
> >> else
> >> {
> >> if ()
> >> {
> >> }
> >> else if ()
> >> {
> >> }
> >> }
> >>
> >> You get the picture.  Code gets hard to read with so many If's and
> >> Elses.
> >>
> >> I would love to:
> >>
> >> if()
> >> {
> >> //Blah
> >> break;
> >> }
> >>
> >> and have that break only stop the rest of the execution of the include
> >> file but allow the script that included it to finish running.
> >>
> >> I have tried break, exit and die with no luck.  Even tried break 1;
> >> and
> >> break 2; to break out of levels but that didn't seem to work either.
> >>
> >> Is there a solution or should I continue to do what I have done.
> >>
> >> Thanks in advance,
> >>
> >> Jonathan Pitcher
> >>
> >>
> >> --
> >> 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
>
>


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



Re: [PHP] how can I logout autamaitcally (using session)

2003-07-02 Thread Jim Lucas
Just tell your server to allow the session lifetime to be 15 minutes

After 15 minutes of inactivity, the session will not exist.

Jim Lucas
- Original Message -
From: "Jeff Harris" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 2:45 PM
Subject: Re: [PHP] how can I logout autamaitcally (using session)


> On Jul 2, 2003, "Hardik Doshi" claimed that:
>
> |Hi,
> |
> |You can add last_request_time variable into the
> |session when user logs into the system. Initially set
> |the time at which user logs in to the system. Now
> |every user click you need to check your
> |last_request_time with the current_time. If the
> |difference of last_request_time and current_time is
> |greater than the thresold limit you have decided (idle
> |time of user) than just logout that particular user
> |otherwise set the current_time to the
> |last_request_time and proceed..
> |
> |I hope the algorithm is clear to you.
> |
> |Let me know if u need any help
> |
> |thanks
> |
> |Hardik Doshi
> |
>
> I just saw a banking site that allows a 15 minute session. I'm guessing
> that the session time is set to 15 minutes for the cookies, and one frame
> contains a countdown clock. When the clock hits zero, it uses javascript
> to redirect to a page that removes the sessions and lets you log in again.
> I'm sure you might be able to recreate it to your needs (as long as they
> don't lay claim to a patent of a count down timer to end a session).
>
> Jeff
>
> --
> Registered Linux user #304026.
> "lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
> Key fingerprint = 52FC 20BD 025A 8C13 5FC6  68C6 9CF9 46C2 B089 0FED
> Responses to this message should conform to RFC 1855.
>
>
>
> --
> 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



Re: [PHP] Break, Exit, Die, Kill, Maime and Stab

2003-07-03 Thread Jim Lucas
i works for me in many different areas on my site

Jim Lucas

- Original Message -
From: "Jeff Moser" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 03, 2003 5:07 AM
Subject: RE: [PHP] Break, Exit, Die, Kill, Maime and Stab


So...why not write the entire included file as a function and then call that
function instead of using include? I'd be interested, though, to hear if the
return broke out of the include.

--
Jeff Moser
Web Developer
ihigh Inc. / Host Interactive
859.232.8282

--


-Original Message-
From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 03, 2003 5:10 AM
To: 'Jim Lucas'; Jonathan Pitcher; [EMAIL PROTECTED]
Subject: RE: [PHP] Break, Exit, Die, Kill, Maime and Stab

> -Original Message-
> From: Jim Lucas [mailto:[EMAIL PROTECTED]
> Sent: 02 July 2003 22:47
>
> Technically you are not outside of a function.
>
> you need to use one of the include or require functions to
> include the file
> right?

include and require are not functions -- they are language constructs.

(Proof:  include 'file.inc';   works.)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



Re: [PHP] php arrays into flash

2003-07-07 Thread Jim Lucas
don't know about loading it directly in flash, but you could always create a
javascript array in the page that loads the flash module and then have flash
read it or javascript enter it into the flash module.

Jim lucas
- Original Message -
From: "Jim McNeely" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 07, 2003 4:29 PM
Subject: [PHP] php arrays into flash


> I know a lot more about php than about flash (which is probably sad)
> but does anyone know how to take info in an array and pass it into an
> array in flash? I think they have arrays, but the only thing I can seem
> to find in flash to get info from php is the loadvariable actionscript
> step. I looked around via google and I couldn't find anything within a
> reasonable time that seemed to answer this question.
>
> TIA
>
> Jim McNeely
> Envision Data
> [EMAIL PROTECTED]
> http://www.envisiondata.com
>
>
> --
> 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



Re: [PHP] Long lines

2003-07-11 Thread Jim Lucas
Try this


$str = "here is some php" .
   "here is more" .
   "here is even more";

Just a plain '.' will do the trick.

Jim Lucas
- Original Message -
From: "Alvaro Rosales R." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 11, 2003 7:11 AM
Subject: [PHP] Long lines


> Hi guys,I am new to PHP and I am writing my first scripts, so maybe this
question
> is a kinda stupid, but it is driving me crazy,  can you tell me How can I
set a line
> break in longs line of my code?.
> thanks in advance!
>
> --
> 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



Re: [PHP] Mind exploded on this one!

2003-07-11 Thread Jim Lucas
You have almost everything correct here

change that last line to this.

 $arrayListArray = compact('booleanNonFormVars', 'booleanVars',
'profileVarArray',
   'profileNonFormVarArray');

notice the use of compact()

Jim Lucas

- Original Message -
From: "Phil Powell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, July 11, 2003 11:21 AM
Subject: [PHP] Mind exploded on this one!


$booleanNonFormVars = array('hasSelectedLetter', 'hasEnteredProfile',
'hasSelectedProfile',
 'hasEditedProfile', 'hasDeletedProfile',
'willDeleteProfile',
 'willDeletePic');
 $booleanVars = array('profileID', 'showemail', 'showbirthday', 'season',
'profilememberid');
 $profileVarArray = array('firstname', 'lastname', 'city', 'state',
'country', 'favebands',
  'faveconcert', 'favescandinavia', 'faveviking',
'favemeat',
  'freetime', 'thingslove', 'thingshate',
'favebibleverse',
  'changeonething', 'maritalstatus', 'birthday',
'favemovie',
  'faveplace', 'favetv', 'imgpath', 'imgext');
 $profileNonFormVarArray = array('profileName', 'letter', 'name');

 $arrayListArray = array('booleanNonFormVars', 'booleanVars',
'profileVarArray',
'profileNonFormVarArray');

Bluntly put, I need to get:
$hasSelectedLetter
$letter

Etc..

I have absolutely NO idea how to do this, help!

Phil



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



Re: [PHP] Private and protected variables in PHP 5?

2003-07-11 Thread Jim Lucas
I think that is what he was meaning.

IT SHOULDN'T WORK THAT WAY, BUT IT DOES!!!

Re-Read his first email a little closer.

Jim Lucas
- Original Message -
From: "Michael Smith" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 11, 2003 3:44 PM
Subject: Re: [PHP] Private and protected variables in PHP 5?


> Hey,
>
> private vars are not accessible that way. This is the way it works...
>
> private $var is only usable by the class. You can't access it through
> $object->var.
>
> protected $var is only usable by the class if it was called directly,
> but not by any objects that are classes that are extended from the base.
> Example:
>
> class Parent {
> protected $var = "test";
> function blah($somevar) {
> ...
> }
> }
>
> class Child extends Parent {
> ...
> }
>
> $parent = new Parent;
> print $parent->var; //ouputs "test"
> $child = new Child;
> print $child->var; //outputs nothing
>
> as you can see $var is only accessible by objects that are specifically
> Parents, not Children.
>
> public vars are accessible by the class itself, ($this->var), derived
> classes, and by $class->var.
>
> HTH,
> Cheers!
> -Michael
> Paul Hudson wrote:
> > All,
> >
> > I'm toying with the new stuff available in PHP 5 (latest CVS), but I've
hit a
> > brick wall: both private and protected don't seem to work as I'd expect
them
> > to.
> >
> > Here's an example script:
> >
> >  >   class dog {
> > // declare two private variables
> > private $Name;
> > private $DogTag;
> >
> > public function bark() {
> >   print "Woof!\n";
> > }
> >   }
> >
> >   // new class, for testing derived stuff
> >   class poodle extends dog {
> > public function bark() {
> >   print "Yip!\n";
> > }
> >   }
> >
> >   // I now create an instance of the
> >   // derived class
> >   $poppy = new poodle;
> >
> >   // and set its private property
> >   $poppy->Name = "Poppy";
> >   print $poppy->Name;
> > ?>
> >
> > For some reason, that script works fine - PHP doesn't object to me
setting
> > private variables in the derived class.  Yet if I use "$poppy = new
dog", the
> > script errors out as expected.  It's almost like PHP inherits the member
> > variables, but not the attached access control.
> >
> > For protected, here's another script:
> >
> >  >   class dog {
> > // this next function is protected
> > // viz, it should be available to dog
> > // and its children
> >
> > protected function bark() {
> >   print "Woof!\n";
> > }
> >   }
> >
> >   class poodle extends dog {
> > // nothing happening here
> >   }
> >
> >   $mydog = new poodle;
> >   // I now call the protected function
> >   $mydog->bark();
> > ?>
> >
> > That script errors out saying that I can't call the protected function
bark -
> > surely, being protected, it should be available in the poodle class too?
> >
> > Of course, it might be that these two pieces of functionality are not
yet
> > implemented in PHP, or, more likely, that I'm just misinterpreting the
> > documentation! ;)
> >
> > If you have any insight, please CC me into your response to the list.
> >
> > Thanks,
> >
> >
> > Paul
> >
>
>
> --
> Pratt Museum IT Intern
> All programmers are playwrights and all computers are lousy actors.
>
>
> --
> 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



Re: [PHP] elegant way of doing something else the last time through a loop?

2003-07-14 Thread Jim Lucas

- Original Message -
From: "Petre Agenbag" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 14, 2003 4:11 AM
Subject: [PHP] elegant way of doing something else the last time through a
loop?


> HI list
>
> Is there an elegant way to know when the last time through the loop is
> going to be and to do something else?
>
>
> I want to search through a table by "exploding" the search string and
> then compounding my own sql string by working through the array.
>
> >From my example below, you can see I use a foreach to loop through the
> array. Arguably I could first determine the amount of elements in the
> array and then use a for instead of a foreach, but I'm not sure if that
> will help ( will probably need a switch instead if you want to work with
> the sheer array elements), however, the if statement inside the loop is
> meant to "strip" out "the" and "and", meaning that it won't much help to
> use that approach anyway.
>
> Anyway, as you can see my problem lies with the SQl when the last
> element is reached, then it should NOT add another "and" or "or".
>
> My attempts at "backtracking" the $sql string/array and start writing
> the end part of the string obviously fails.
>
> Any help with my "logic", ie, how do/would you guys do this?
>
> Thanks
>
>
> $table_name = "test";
> if ($_POST[any_all] == "any") {
> $logic = "or";
> }
> elseif ($_POST[any_all] == "all") {
> $logic = "and";
> }
>
> $string = $_POST[text];
> $phrases = explode(" ", $string);
>
> $sql = "select * from $table_name where ";
>
> foreach ($phrases as $key=>$val) {
> if (($val != "the") && ($val != "and")) {
> $sql.= "name like '%$val%'  $logic";
> }
> }
>
> $length = strlen($sql);
> $newlen = $length - 4;
> $sql[$newlen].= " order by name";
> echo $sql;
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



Try this

$left = array();
foreach ( $phrases as $k => $v ) {
  if (in_array($v, array('the','and'))) {
$left[] = "name like '% ".addslashes($val)." %' {$logic} ";
  }
}
$where = join ( '', $left );

Jim Lucas



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



Re: [PHP] HTML email with Outlook

2003-07-15 Thread Jim Lucas
I would take a look at the headers of an email that does render html
correctly in outlook and see what you are missing.

Trial and error.

Jim Lucas

- Original Message -
From: "Tim Thorburn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 15, 2003 3:48 PM
Subject: [PHP] HTML email with Outlook


> Hi,
>
> I've made a PHP script that sends out an automatic email through my
servers
> cron system, it works well, but I thought I'd try to do some HTML email to
> get things to line up a little better.
>
> To do so, I added the following line in my mail() command: -Type:
> text/html; charset=iso-8859-1
>
> When I check the messages sent out with Eudora, the HTML email comes in
> perfectly.  However, when I check with Outlook Express 6 - I get the
actual
> HTML code rather than the nicely formatted email that I had created.
>
> Should I be using another line in my mail() command?  I've recieved HTML
> email before with Outlook Express on my machine without changing any
> settings at all.  Also, I had sent an email from my script to hotmail and
> the HTML email worked fine there too.
>
> Any thoughts?
>
> Thanks
> -Tim
>
>
>
> --
> 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



Re: [PHP] I'm really getting annoyed with PHP

2003-07-24 Thread Jim Lucas
can someone post the original source that he submitted.   I was gone
yesterday and missed it.

Thanks
Jim
- Original Message -
From: "Curt Zirzow" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Thursday, July 24, 2003 9:11 AM
Subject: Re: [PHP] I'm really getting annoyed with PHP


> * Thus wrote Pushpinder Singh Garcha ([EMAIL PROTECTED]):
> > try this,
> >
> >
> > use a meta-refresh ...
> >
> > echo " > content=\"3;URL=http://wherever_u_wana_go.com/hello.html\";>";
>
> This has already been discussed, and is not the preferred method of
> doing redirects. PHP can handle what he is doing just fine.
>
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
>
> --
> 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



Re: [PHP] Link acting as a submit button

2003-07-25 Thread Jim Lucas
Depends, are you trying access the form from a different frame?

Jim Lucas
- Original Message -
From: "Matt Palermo" <[EMAIL PROTECTED]>
To: "Jim Lucas" <[EMAIL PROTECTED]>; "Matt Palermo" <[EMAIL PROTECTED]>;
"php-general" <[EMAIL PROTECTED]>
Sent: Friday, July 25, 2003 4:30 AM
Subject: RE: [PHP] Link acting as a submit button


> I just remembered (I'm not sure if it makes a difference) that I am using
> frames on this page.  Does this matter at all?  Thanks.
>
> Matt
>
>
>
> >= Original Message From Matt Palermo <[EMAIL PROTECTED]> =
> >Fixing the javascript that you specified still gave me the same
> >errors...  Got any more suggestions?
> >
> >Thanks for your help,
> >
> >Matt
> >
> >-Original Message-
> >From: Jim Lucas [mailto:[EMAIL PROTECTED]
> >Sent: Thursday, July 24, 2003 6:40 PM
> >To: Matt Palermo
> >Subject: Re: [PHP] Link acting as a submit button
> >
> >Your javascript is wrong.
> >
> >change this
> >document.forms[0].action = where;
> >to this
> >document.forms[0].action.value = where;
> >
> >Jim Lucas
> >
> >- Original Message -
> >From: "Matt Palermo" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Thursday, July 24, 2003 3:35 PM
> >Subject: [PHP] Link acting as a submit button
> >
> >
> >> I am trying to create a submit button out of a hyperlink using the
> >> following
> >> code:
> >>
> >> (this is in a file called index.html)
> >> this
> >> page
> >>
> >>
> >> 
> >> <!--
> >> function go_where_my_variable_says(where)
> >> {
> >> document.forms[0].action = where;
> >> document.forms[0].submit();
> >> }
> >> //-->
> >> 
> >>
> >> This works fine as an html document, however, when I try to echo the
> >> same code
> >> out in a PHP page, it gives me javascript errors.  I am using the
> >> following to
> >> echo it out in PHP:
> >>
> >> echo "
> >> this
> >> page
> >>
> >>
> >> 
> >> <!--
> >> function go_where_my_variable_says(where)
> >> {
> >> document.forms[0].action = where;
> >> document.forms[0].submit();
> >> }
> >> //-->
> >> 
> >> ";
> >>
> >> This displays the link fine for the submit hyperlink, but it gives the
> >
> >> javascript error:
> >>
> >> Error:  Object doesn't support this property or method.
> >> Code:  0
> >>
> >> Like I said before, this code works perfectly fine if I have it an
> >html
> >> document.
> >>
> >> Anyone got any ideas?
> >>
> >> Thanks,
> >> Matt
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> >--
> >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



Re: [PHP] Half solved...............what the @#%# is PHPSESSID?

2003-07-26 Thread Jim Lucas
Personally, I would do a search-and-replace for header() and replace it with
your own custom header() function.

Then you would only have to change one location.

Jim Lucas
- Original Message -
From: "Ryan A" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, July 26, 2003 1:16 PM
Subject: Re: [PHP] Half solved...what the @#%# is PHPSESSID?


> Hey John,
> I dont think its the browser because I have tried this with opera 6,opera
7,
> IE and NN with the same results...
> But when i checked the phpinfo() it says that cookies are enabledDo
you
> think its worth it to search and replace each Location header with .SID?
>
> Thanks,
> -Ryan
>
>
>
> - Original Message -
> From: "John W. Holmes" <[EMAIL PROTECTED]>
> To: "Ryan A" <[EMAIL PROTECTED]>
> Cc: "Marek Kilimajer" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Saturday, July 26, 2003 9:15 PM
> Subject: Re: [PHP] Half solved...what the @#%# is PHPSESSID?
>
>
> > Ryan A wrote:
> >
> > > I know you can manipulate the php.ini file via htaccess or by putting
> some
> > > instructions in the include file...is there any way to turn on cookies
> again
> > > and turn off session.use_trans_sid so i can go back to the old way it
> was?
> > > because I have a lot of header("location:") statements in a lot of
> > > files.
> >
> > Your browser is not accepting the cookies... Or, your session module has
> > been told not to use cookies. To enable cookies for the session module,
> use:
> >
> > php.ini:
> > session.use_cookies = 1
> >
> > .htaccess:
> > php_value session.use_cookies 1
> >
> > If the value is already 1 or ON, then it's your browser causing the
> > trouble.
> >
> > --
> > ---John Holmes...
> >
> > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> >
> > PHP|Architect: A magazine for PHP Professionals – www.phparch.com
> >
> >
> >
> >
>
>
> --
> 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



Re: [PHP]IE6 back button problems

2003-07-28 Thread Jim Lucas
Try taking the value='' out of your form fields.

if you have it reseting the values every time the page is loaded, it will
reset the values.

Jim Lucas
- Original Message -
From: "Jim McNeely" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 3:20 AM
Subject: [PHP]IE6 back button problems


> Here's a puzzler, I've searched the archives and couldn't find a
> satisfactory answer, and it would be nice to have one in the archives.
>
> I'm working on a web app that draws a search screen with fields coming
> from settings in a database.
>
> When you do the search, it works fine, but in IE 6 on WinXP when you
> hit the back button it loses the user's form field entries. This is not
> true of IE 5 on the mac, Safari, etc. I've tried all kinds of tweaks to
> the settings in IE6's internet options to no avail.
>
> However, I think it is too simplistic to say that it is just the
> browser, because IE6 maintains form field entries when using the back
> button on some sites, like google.
>
> All pages in the web app force a refresh by sending these headers:
> ##Header Info to force refresh
>header( "Last-Modified: " .
>  gmdate( "D, d M Y H:i:s",
> filemtime( $_SERVER['SCRIPT_FILENAME'] ) ) .
>  " GMT");
>header("Cache-Control: no-store, no-cache, must-revalidate");
>header("Cache-Control: post-check=0, precheck=0", false);
>header("Pragma: no-cache");
> ##
>
> I've tried commenting out some or all of these to no avail, it still
> loses the user's form fields.
>
> HOWEVER, I also tried setting a test session variable to something in
> the search results page, and when you hit the back button in IE6 if you
> echo that variable on the search page it echoes the NEW value; other
> browsers it does NOT. So IE6 is requerying for the page without resort
> to a cache, while the others are using cached pages. All the header
> code hooie doesn't seem to affect any of this when you are talking
> about the back button.
>
> TIA
>
> Jim McNeely
>
>
> --
> 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



Re: [PHP] Array Question

2003-07-28 Thread Jim Lucas
Try this.

$companyname[] = $row['company'];


Jim Lucas
- Original Message - 
From: "Pushpinder Singh Garcha" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 10:16 AM
Subject: [PHP] Array Question


hello everyone,

  I am trying to store one of the fields of the resultset into an array  
as I display the results.

   while ($row = mysql_fetch_array($result1)) {

 // Alternate the bgcolor of each row for visibility
 ($even % 2) == 0 ? $bgcolor = "#EFEFEF" : $bgcolor =  
"#ee";
 $even = $even + 1;

 // print the actual row
echo   "
   $row[company]
   $row[name_1]
   $row[phone_1]
  $row[city]
  $row[url]
   $row[email_1]
  --Link--
   ";

// try to store the name of the company in an array called companyname

$companyname = array($row['company']);

 // try to register the variable

 $_SESSION['link'] = $companyname;
   //$_SESSION['link'] = $row[company];

 } // end while



I am trying to store the variable $row['company'] into a array called  
companyname[], so that I am able to register it as a session variable  
and use it on subsequent pages. I keep getting errors and am not able  
to store the values in array $row['company'] . I would appreciate if  
someone could throw some light on this.

Thanks in advance.
--Pushpinder



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



Re: [PHP] MySQL query/PHP logic?

2003-07-29 Thread Jim Lucas
Try something like this.

select
  fof.id AS fof_id, fof.information_sent AS fof_info,
  pub.id AS pub_id, pub.information_sent AS pub_info,
  gov.id AS gov_id, gov.information_sent AS gov_info,
  med.id AS med_id, med.information_sent AS med_info,
  ngo.id AS ngo_id, ngo.information_sent AS ngo_info,
  own.id AS own_id, own.information_sent AS own_info,
  sup.id AS sup_id, sup.information_sent AS tup_info,
  tra.id AS tra_id, tra.information_sent AS tra_info,
from main
 left join fof on main.id = fof.id
 left join pub on main.id = pub.id
 left join gov on main.id = gov.id
 left join med on main.id = med.id
 left join ngo on main.id = ngo.id
 left join own on main.id = own.id
 left join sup on main.id = sup.id
 left join tra on main.id = tra.id
where (
 (fof.information_sent > '$date1' and fof.information_sent < '$date2')
 OR
 (pub.information_sent > '$date1' and pub.information_sent < '$date2')
 OR
 (gov.information_sent > '$date1' and gov.information_sent < '$date2')
 OR
 (med.information_sent > '$date1' and med.information_sent < '$date2')
 OR
 (ngo.information_sent > '$date1' and ngo.information_sent < '$date2')
 OR
 (own.information_sent > '$date1' and own.information_sent < '$date2')
 OR
 (sup.information_sent > '$date1' and sup.information_sent < '$date2')
 OR
 (tra.information_sent > '$date1' and tra.information_sent < '$date2')
 )
order by entity_name

then in your loop you will need to look for something like this.

while($row = mysql_fetch_array($results)){
  if(!empty($row['fof_id']))
   echo "found";
  if(!empty($row['fof_id']))
   echo "found";
  etc...
}

You get my point,  but the big part is the select *  <-- part of the sql
call

you have to identify each column that you want back with an alias otherwise
they stomp all over one another.

Jim Lucas

- Original Message -
From: "Petre Agenbag" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 29, 2003 2:13 PM
Subject: [PHP] MySQL query/PHP logic?


> Hi List
>  OK, I've posted this on the MySQL list as well, but it seems a bit quiet
> there, and arguably it could definately be a PHP rather than mysql
question
> depending on whether it can be done with one query (then it was/is a mysql
> query), or whether it should be done with some structures and multiple
> queries ( then it's arguably PHP).
>
> So, here goes.
>
>
> I'm trying to return from multiple tables, the records that have field
> "information_sent" between two dates.
> The tables are all related by means of the id of the entry in the main
> table, ie..
>
> main
> id entity_name ...
>
> fof
> id_fof id information_sent ...
>
> pub
> id_pub id information_sent ...
>
> etc.
>
> So, I tried the following join
>
> select * from main
> left join fof on main.id = fof.id
> left join pub on main.id = pub.id
> left join gov on main.id = gov.id
> left join med on main.id = med.id
> left join ngo on main.id = ngo.id
> left join own on main.id = own.id
> left join sup on main.id = sup.id
> left join tra on main.id = tra.id
> where (
> (fof.information_sent > '$date1' and fof.information_sent < '$date2')
> OR
> (pub.information_sent > '$date1' and pub.information_sent < '$date2')
> OR
> (gov.information_sent > '$date1' and gov.information_sent < '$date2')
> OR
> (med.information_sent > '$date1' and med.information_sent < '$date2')
> OR
> (ngo.information_sent > '$date1' and ngo.information_sent < '$date2')
> OR
> (own.information_sent > '$date1' and own.information_sent < '$date2')
> OR
> (sup.information_sent > '$date1' and sup.information_sent < '$date2')
> OR
> (tra.information_sent > '$date1' and tra.information_sent < '$date2')
> )
> order by entity_name
>
>
> BUT, although it seems to be "joining" the tables correctly AND only
> returning the ones with the correct date criteria, it does NOT return
> the "id" or the "information_sent" fields correctly ( due to duplication
> in the result )
>
> Can this be done in one query without sub-selects, or should it be broken
up
> (in which case I would still need help with the logic and to minimize the
> amount of queries inside loops)
>
>
> Thanks
>
>
>
> --
> 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



Re: [PHP] Globals

2003-08-01 Thread Jim Lucas
I can't speek about the first problem, but about the second one.

You are not setting the variable $blah as a global variable.

Try this instead

$GLOBALS['blah'] = 'bob';

and that should work.

You need to look into scope when refering to variables and functions.

Jim Lucas

- Original Message - 
From: "Chris Boget" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Friday, August 01, 2003 12:03 PM
Subject: [PHP] Globals


> I'm curious if someone could explain to me why this is occuring:
> 
> function blah() {
>   //global $GLOBALS;
> echo 'Globals: '; print_r( $GLOBALS ); echo '';
> 
> }
> 
> As it is shown above, with the 'global $GLOBALS' line commented
> out, the print_r() works and shows all the currently defined variables
> and their corresponding values.  However, if I declare $GLOBALS
> as global, nothing gets printed out.
> 
> Why?
> 
> Wouldn't the 'global $GLOBALS' line be more or less redundant in
> most cases?  Because $GLOBALS is a superglobal (though, it isn't
> really)?  Why would it affect whether or not $GLOBALS actually has
> the expected data inside the function?
> 
> While I'm on this subject, why isn't $GLOBALS always a superglobal?
> For example, this doesn't work:
> 
> function innerFunc() {
> 
>   echo $GLOBALS['blah'];
> 
> }
> 
> function outerFunc() {
> 
>   innerFunc();
> 
> }
> 
> $blah = 'bob';
> outerFunc();
> 
> Nothing gets echoed from innerFunc().  Why?  If anyone can offer
> any insight as to what is going on, I'd be ever so appreciative.
> 
> 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



Re: [PHP] Globals

2003-08-01 Thread Jim Lucas
Maybe it has to do with the fact that the $GLOBALS[] array has a copy of
itself inside the parent.

kinda weird but it looks like this

$GLOBALS['key1'] = 'value1';
$GLOBALS['key2'] = 'value2';
$GLOBALS['GLOBALS']['key1'] = 'value1';
$GLOBALS['GLOBALS']['key2'] = 'value2';

don't ask me why, but it seems odd to me to do this.  A little redundant if
you ask me.

Jim Lucas
- Original Message -
From: "Chris Boget" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Friday, August 01, 2003 12:17 PM
Subject: Re: [PHP] Globals


>
> > I'm curious if someone could explain to me why this is occuring:
> >
> > function blah() {
> >   //global $GLOBALS;
> > echo 'Globals: '; print_r( $GLOBALS ); echo '';
> >
> > }
> >
> > As it is shown above, with the 'global $GLOBALS' line commented
> > out, the print_r() works and shows all the currently defined variables
> > and their corresponding values.  However, if I declare $GLOBALS
> > as global, nothing gets printed out.
> >
> > Why?
>
> The above is all I really need to know.  The rest of my previous email
> was the result of a massive brainfart.
> Sorry about that...
>
> 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



Re: [PHP] Globals

2003-08-01 Thread Jim Lucas
just to let you know, the $GLOBALS[] superglobals  was around long before
php 4.1.0

Jim Lucas
- Original Message -
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "Chris Boget" <[EMAIL PROTECTED]>; "PHP General"
<[EMAIL PROTECTED]>
Sent: Friday, August 01, 2003 12:18 PM
Subject: RE: [PHP] Globals


[snip]
$GLOBALS
[/snip]

>From http://us2.php.net/language.variables.scope

"The $GLOBALS array is an associative array with the name of the global
variable being the key and the contents of that variable being the value
of the array element. Notice how $GLOBALS exists in any scope, this is
because $GLOBALS is a superglobal."

// Superglobals are available in any scope and do
// not require 'global'.  Superglobals are available
// as of PHP 4.1.0

HTH!

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



Re: [PHP] Re: Globals

2003-08-01 Thread Jim Lucas
actually, it does work and it does exist.

Try using print_r() or 

print_r(array_keys($GLOBALS));


and you will see an entry for GLOBALS

mine is located at #13

Jim Lucas

- Original Message - 
From: "Greg Beaver" <[EMAIL PROTECTED]>
To: "Leif K-Brooks" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 01, 2003 12:45 PM
Subject: Re: [PHP] Re: Globals


> Try this code:
> 
>  function blah() {
>   var_dump($GLOBALS['GLOBALS']);
> 
> }
> 
> blah();
> ?>
> 
> It appears that in a function scope, it doesn't.  This is definitely a 
> bug, I'll post it if it hasn't already been noticed.
> 
> Greg
> 
> Leif K-Brooks wrote:
> 
> > Greg Beaver wrote:
> >
> >> $GLOBALS does not contain a reference to itself
> >
> >
> > Yes it does. I just ran the following, and I got "Greg is wrong."
> >
> >  > $foo = 'Greg is wrong.';
> > echo $GLOBALS['GLOBALS']['GLOBALS']['GLOBALS']['foo'];
> > ?>
> >
> 
> 
> -- 
> 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



Re: [PHP] Re: Globals

2003-08-01 Thread Jim Lucas
umm...  That is what is going to happen when you follow your example.

I think you are mistaken in what you are expecting...

This line:
  $a = array_keys($GLOBALS);

will give you an array of values that match the keys of the $GLOBALS array

it won't copy the arrays.

Try this.


 $value) {
  echo $key."=>(".$value.")\n";
}
?>

Jim Lucas

- Original Message -
From: "Greg Beaver" <[EMAIL PROTECTED]>
To: "Jim Lucas" <[EMAIL PROTECTED]>
Cc: "Leif K-Brooks" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Friday, August 01, 2003 1:42 PM
Subject: Re: [PHP] Re: Globals


> Hi Jim,
>
> The code you posted is correct, I never contested that.  Read carefully.
>
>  function not_super()
> {
> var_dump(isset($GLOBALS['GLOBALS']));
> $a = array_keys($GLOBALS);
>
> var_dump(isset($a['GLOBALS']));
> }
> not_super();
> ?>
>
> run this code, don't read it, you will see output of bool(false),
> bool(false)
>
> However, the following code works as expected!
>
>  function not_super()
> {
>     return array_keys($GLOBALS);
> }
> var_dump(not_super(), array_keys($GLOBALS));
> ?>
>
> GLOBALS will be present in both arrays.
>
> Very odd behavior.
>
> Greg
>
>
> Jim Lucas wrote:
>
> >actually, it does work and it does exist.
> >
> >Try using print_r() or
> >
> >print_r(array_keys($GLOBALS));
> >
> >
> >and you will see an entry for GLOBALS
> >
> >mine is located at #13
> >
> >Jim Lucas
> >
> >- Original Message -
> >From: "Greg Beaver" <[EMAIL PROTECTED]>
> >To: "Leif K-Brooks" <[EMAIL PROTECTED]>
> >Cc: <[EMAIL PROTECTED]>
> >Sent: Friday, August 01, 2003 12:45 PM
> >Subject: Re: [PHP] Re: Globals
> >
> >
> >
> >
> >>Try this code:
> >>
> >> >>function blah() {
> >>  var_dump($GLOBALS['GLOBALS']);
> >>
> >>}
> >>
> >>blah();
> >>?>
> >>
> >>It appears that in a function scope, it doesn't.  This is definitely a
> >>bug, I'll post it if it hasn't already been noticed.
> >>
> >>Greg
> >>
> >>Leif K-Brooks wrote:
> >>
> >>
> >>
> >>>Greg Beaver wrote:
> >>>
> >>>
> >>>
> >>>>$GLOBALS does not contain a reference to itself
> >>>>
> >>>>
> >>>Yes it does. I just ran the following, and I got "Greg is wrong."
> >>>
> >>> >>>$foo = 'Greg is wrong.';
> >>>echo $GLOBALS['GLOBALS']['GLOBALS']['GLOBALS']['foo'];
> >>>?>
> >>>
> >>>
> >>>
> >>--
> >>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



Re: [PHP] Re: Globals

2003-08-01 Thread Jim Lucas
I don't follow what you are trying to say here?

it is returning true, just as it should.

show me the results that you get by running this code.

here is mine

bool(true)
bool(true)


What is wrong about this?

Read my notes below


To: "Jim Lucas" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 01, 2003 2:43 PM
Subject: Re: [PHP] Re: Globals


> Jim,
>
> My bad, I posted the wrong code.  Try this instead to see the bug:
>
>  function not_super()
> {
> var_dump(isset($GLOBALS['GLOBALS']));
> return array_keys($GLOBALS);
> }
> //var_dump(not_super(), array_keys($GLOBALS));
> not_super();
> not_super();
>
>
> ?>
>
> run this code, don't read it, you will see output of bool(false),
> bool(false)
>
> However, the following code works as expected!
>
>  function not_super()
> {
> return array_keys($GLOBALS);
> }
> var_dump(not_super(), array_keys($GLOBALS));
> ?>
>
> GLOBALS will be present in both arrays.
>
> Very odd behavior.
>
> Note that in PHP 5.0.0b1, the first function does work, so this is fixed
> somewhere in there.
>
> Greg
> --
> phpDocumentor
> http://www.phpdoc.org
>
> Jim Lucas wrote:
>
> >umm...  That is what is going to happen when you follow your example.
> >
> >I think you are mistaken in what you are expecting...
> >
> >This line:
> >  $a = array_keys($GLOBALS);
> >
> >will give you an array of values that match the keys of the $GLOBALS
array
> >
> >it won't copy the arrays.
> >
> >Try this.
> >
> >
> > >$a = array_keys($GLOBALS);
> >foreach($a AS $key => $value) {
> >  echo $key."=>(".$value.")\n";
> >}
> >?>
> >
> >Jim Lucas
> >
> >- Original Message -
> >From: "Greg Beaver" <[EMAIL PROTECTED]>
> >To: "Jim Lucas" <[EMAIL PROTECTED]>
> >Cc: "Leif K-Brooks" <[EMAIL PROTECTED]>;
> ><[EMAIL PROTECTED]>
> >Sent: Friday, August 01, 2003 1:42 PM
> >Subject: Re: [PHP] Re: Globals
> >
> >
> >
> >
> >>Hi Jim,
> >>
> >>The code you posted is correct, I never contested that.  Read carefully.
> >>
> >> >>function not_super()
> >>{
> >>var_dump(isset($GLOBALS['GLOBALS']));
> >>$a = array_keys($GLOBALS);
> >>
> >>var_dump(isset($a['GLOBALS']));
> >>}
> >>not_super();
> >>?>
> >>
> >>run this code, don't read it, you will see output of bool(false),
> >>bool(false)
> >>
> >>However, the following code works as expected!
> >>
> >> >>function not_super()
> >>{
> >>return array_keys($GLOBALS);
> >>}
> >>var_dump(not_super(), array_keys($GLOBALS));
> >>?>
> >>
> >>GLOBALS will be present in both arrays.
> >>
> >>Very odd behavior.
> >>
> >>Greg
> >>
> >>
> >>Jim Lucas wrote:
> >>
> >>
> >>
> >>>actually, it does work and it does exist.
> >>>
> >>>Try using print_r() or
> >>>
> >>>print_r(array_keys($GLOBALS));
> >>>
> >>>
> >>>and you will see an entry for GLOBALS
> >>>
> >>>mine is located at #13
> >>>
> >>>Jim Lucas
> >>>
> >>>- Original Message -
> >>>From: "Greg Beaver" <[EMAIL PROTECTED]>
> >>>To: "Leif K-Brooks" <[EMAIL PROTECTED]>
> >>>Cc: <[EMAIL PROTECTED]>
> >>>Sent: Friday, August 01, 2003 12:45 PM
> >>>Subject: Re: [PHP] Re: Globals
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>Try this code:
> >>>>
> >>>> >>>>function blah() {
> >>>> var_dump($GLOBALS['GLOBALS']);
> >>>>
> >>>>}
> >>>>
> >>>>blah();
> >>>>?>
> >>>>
> >>>>It appears that in a function scope, it doesn't.  This is definitely a
> >>>>bug, I'll post it if it hasn't already been noticed.
> >>>>
> >>>>Greg
> >>>>
> >>>>Leif K-Brooks wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Greg Beaver wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>$GLOBALS does not contain a reference to itself
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>Yes it does. I just ran the following, and I got "Greg is wrong."
> >>>>>
> >>>>> >>>>>$foo = 'Greg is wrong.';
> >>>>>echo $GLOBALS['GLOBALS']['GLOBALS']['GLOBALS']['foo'];
> >>>>>?>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>--
> >>>>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



Re: [PHP] Re: Globals

2003-08-01 Thread Jim Lucas
I am running PHP 4.2.2 on Debian linux with apache 1.3.26

Jim
  - Original Message - 
  From: Greg Beaver 
  To: Jim Lucas 
  Cc: [EMAIL PROTECTED] 
  Sent: Friday, August 01, 2003 3:02 PM
  Subject: Re: [PHP] Re: Globals


  What version of PHP are you running?  I have PHP 4.3.2 on windows XP here.  I'm 
getting bool(false) bool(false) every time.

  Greg

  Jim Lucas wrote:

I don't follow what you are trying to say here?

it is returning true, just as it should.

show me the results that you get by running this code.

here is mine

bool(true)
bool(true)


What is wrong about this?

Read my notes below


To: "Jim Lucas" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 01, 2003 2:43 PM
Subject: Re: [PHP] Re: Globals


  
Jim,

My bad, I posted the wrong code.  Try this instead to see the bug:



run this code, don't read it, you will see output of bool(false),
bool(false)

However, the following code works as expected!



GLOBALS will be present in both arrays.

Very odd behavior.

Note that in PHP 5.0.0b1, the first function does work, so this is fixed
somewhere in there.

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

Jim Lucas wrote:


umm...  That is what is going to happen when you follow your example.

I think you are mistaken in what you are expecting...

This line:
 $a = array_keys($GLOBALS);

will give you an array of values that match the keys of the $GLOBALS
  
array
  
it won't copy the arrays.

Try this.


 $value) {
 echo $key."=>(".$value.")\n";
}
?>

Jim Lucas

- Original Message -
From: "Greg Beaver" <[EMAIL PROTECTED]>
To: "Jim Lucas" <[EMAIL PROTECTED]>
Cc: "Leif K-Brooks" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Friday, August 01, 2003 1:42 PM
Subject: Re: [PHP] Re: Globals




  
Hi Jim,

The code you posted is correct, I never contested that.  Read carefully.



run this code, don't read it, you will see output of bool(false),
bool(false)

However, the following code works as expected!



GLOBALS will be present in both arrays.

Very odd behavior.

Greg


Jim Lucas wrote:




actually, it does work and it does exist.

Try using print_r() or

print_r(array_keys($GLOBALS));


and you will see an entry for GLOBALS

mine is located at #13

Jim Lucas

- Original Message -
From: "Greg Beaver" <[EMAIL PROTECTED]>
To: "Leif K-Brooks" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 01, 2003 12:45 PM
Subject: Re: [PHP] Re: Globals






  
Try this code:



It appears that in a function scope, it doesn't.  This is definitely a
bug, I'll post it if it hasn't already been noticed.

Greg

Leif K-Brooks wrote:






Greg Beaver wrote:





  
$GLOBALS does not contain a reference to itself





Yes it does. I just ran the following, and I got "Greg is wrong."







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











  




  




  



Re: [PHP] weird php error

2003-08-01 Thread Jim Lucas
yes it could be in the httpd.conf file.

look in your VirtualHost block and see if something there refers to a file
called loging.php

Jim Lucas
- Original Message -
From: "Matt Giddings" <[EMAIL PROTECTED]>
To: "'David Nicholson'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 01, 2003 4:33 PM
Subject: RE: [PHP] weird php error


David,

  This is what my php.ini file looks like and I don't seem to have any
.htaccess files.  Could it be something in the httpd.conf file that’s
pointing to an invalid file/directory?

; Automatically add files before or after any PHP document.
auto_prepend_file =
auto_append_file =

Matt


> -Original Message-
> From: David Nicholson [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 01, 2003 7:13 PM
> To: Matt Giddings
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] weird php error
>
> Hello,
>
> This is a reply to an e-mail that you wrote on Sat, 2 Aug 2003 at
> 00:10, lines prefixed by '>' were originally written by you.
> > Hello,
> >   I'm getting a weird warning message from a php script that I'm
> > working
> > on.  Right now the script does not contain any include or require
> > statements and is basically a very simple straight forward script.
>
> > But
> > when I try to execute via the browser I get the following error:
> > Warning: Failed opening '/var/www/main/htdocs/login.php' for
> inclusion
> > (include_path='.:/usr/share/pear') in Unknown on line 0
> > Any clues?  I can send a copy of the script if anybody would
> like.
>
> You have your auto_prepend_file value set to a file that does not
> exist in your php.ini file or a .htaccess file.  I just tested it and
> it gives this exact error.
>
> HTH
>
> David.
>
> --
> phpmachine :: The quick and easy to use service providing you with
> professionally developed PHP scripts :: http://www.phpmachine.com/
>
>   Professional Web Development by David Nicholson
> http://www.djnicholson.com/
>
> QuizSender.com - How well do your friends actually know you?
>  http://www.quizsender.com/
> (developed entirely in PHP)
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
>

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/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



Re: [PHP] Regular expression question

2003-08-04 Thread Jim Lucas
well, first off '>' should not be allowed as a value of an attr="" pair
anyways.

You should convert it to > or <

this will solve that problem.

Jim Lucas
- Original Message -
From: "Dan Phiffer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 04, 2003 4:03 PM
Subject: [PHP] Regular expression question


> So I want to grab the attributes out of an HTML element. The following
> works, except in the case that the attribute's value includes the
character
> ">":
>
> if (preg_match_all("/]*)>/i", $subject, $matches))
> print_r($matches);
>
> A $subject of "" gives:
>
> Array
> (
> [0] => Array
> (
> [0] =>
> )
>
> [1] => Array
> (
> [0] =>  attr="value"
> )
>
> )
>
> A $subject of "\">" gives:
>
> Array
> (
> [0] => Array
> (
> [0] =>
>
> Thanks for any help,
> -Dan
>
>
> --
> 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



Re: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Jim Lucas
Give an example db layout and/or array layout that you plan on using.

Would I be correct in assuming that the array would look something like
this?

$values['val_1'] = 100.00;
$values['val_2'] = 150.00;
$values['val_3'] = 200.00;
$values['val_4'] = 250.00;
$values['val_5'] = 100.00;

if this is correct you could do something like this.

$t=0;
foreach($values AS $amnt)
  $t += $amnt;

echo $t;  // this should return 800

if you wanted the formatted return to be something like xxx.xx you'll want
to use something like number_format()

if for some reason you are getting it from mysql then it could look like the
following.

$sql = "SELECT title, val FROM tbl";
$results = mysql_query($sql);

$t=0;
while($row = mysql_fetch_assoc($results)) {
  $t += $row['val'];
}
echo $t;

Maybe you have a different style sql statement.

$sql = "SELECT SUM(val) FROM tbl";
$results = mysql_query($sql);
list($t) = mysql_fetch_row($results)) {
echo $t;

Notice the difference in mysql_fetch_* functions

if you want the second sql statement used but want to refer to it by a name.
do this

$sql = "SELECT SUM(val) AS total FROM tbl";
$results = mysql_query($sql);
$arr = mysql_fetch_assoc($results);
echo $arr['total'];


If i confused you with all the different ways to do this, don't worry, I
confused myself also.

If need be, I will explain more.

Jim Lucas

- Original Message -
From: "Ben C." <[EMAIL PROTECTED]>
To: "Jay Blanchard" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Monday, August 04, 2003 2:04 PM
Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL


> Let me try and explain a little better and easier.  What I am trying to do
is take a list of values and add them to get.  I am getting the values from
a database query.
>
> Assuming that I had the following:
> val_1 100.00
> val_2 150.00
> val_3 200.00
> val_4 250.00
> val_5 100.00
>
> What I want to do now is add up the values 1-5 and get 800.00.
>
> Does this help clarify?
>
>
>
>
> >
> > From: "Jay Blanchard" <[EMAIL PROTECTED]>
> > Date: 2003/08/04 Mon PM 04:57:17 EDT
> > To: "Ben C." <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> > Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL
> >
> > [snip]
> > Unsure.  How would I do that?
> > [/snip]
> >
> > Ben I think that we have a communications failure. Let's start
> > over...you wish to total a database column using php, correct?
> > Everything that you have been shown so far will do that. Is it possible
> > that there are no query results? If not, then we are doing the query
> > wrong. Try it with single quotes;
> >
> > $sql_2 = "SELECT paidamount FROM $tb_name WHERE id = '" . $id . "' ";
> >
> > Please do a verbose check on the query to see if it is working properly
> >
> > if(!($result_2 = mysql_query($sql_2, $connection))){
> >print("MySQL reports: " . mysql_error() . "\n");
> >exit();
> > }
> >
> > Let's use objects instead of arrays (humor me for a moment)
> >
> > while($row = mysql_fetch_object($result_2)){
> > $paid = $row->paidamount;
> > echo "$paid \n";
> > $total = $total + paid;
> > }
> >
> > echo "$total \n";
> >
> > Please copy and paste the results into your reply
> >
>
>
> --
> 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



Re: [PHP] Correct Coding

2003-08-08 Thread Jim Lucas
Could you explain a little better why this would make things better?

I don't understand how this would improve things.

Jim Lucas
- Original Message - 
From: "Curt Zirzow" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 07, 2003 10:28 AM
Subject: Re: [PHP] Correct Coding


> * Thus wrote Christopher J. Crane ([EMAIL PROTECTED]):
> > Is this the best way to do this?
> > 
> > if(isset($Task) && $Task == "Add") { Do something }
> > 
> > I want to check if the variable is set and if so, if it is "Add".
> 
> Yes, that is good. Remember, though, it is case sensitive so "ADD"
> wont match. 
> 
> Concerning the $Task == "Add", I'd like to make a comment.  It can
> be a wise decision to compare your variables with strings like:
> 
> if ("Add" == $Task)
> 
> This can help preventing typo's  like:
> 
> if ($Task = "Add")
> 
> I've seen people tear their hair out wondering why the if statement
> is always true even if $Task is not "Add". I don't see this method
> used very often but it can prevent serious logic typos.
> 
> 
> HTH,
> 
> Curt
> -- 
> "I used to think I was indecisive, but now I'm not so sure."
> 
> -- 
> 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



Re: [PHP] Simple cookie question

2003-08-09 Thread Jim Lucas
Assuming that you have a process page that stores the submitted choice, have
the process page make the cookie setting and then redirect back to the first
page.

Or better yet, I like it when my original page never leaves and a popup
window is openned to save my choice and then show me the results for that
given vote.

Jim Lucas
- Original Message -
From: "Matthew Koh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 09, 2003 4:22 PM
Subject: [PHP] Simple cookie question


> This may be a stupid question, but I'm trying to set up a system where I
can
> take a poll from visitors to my website and then set a cookie so that they
> can't vote more than once (until they clear their cookies at least).
> Problem is, I don't want to put it at the top of my page, because what if
> somebody opens up a poll but decides not to vote, then later changes his
> mind.  The cookie will prevent him from voting.  I want the cookie to be
set
> right after the user clicks the vote button, but every time I do that, I
get
> an error about headers already being sent.  Is there any way around this?
>
> Thanks
>
>
>
> --
> 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



[PHP] Re: Sum a column of values from a MySQL query

2003-08-14 Thread Jim Lucas
What are you expecting back from the sql statement?

And what are you getting?

>From what I can tell, if you are getting all your amounts from the select
statement then you are already totalling them up inside the select
statements by using the sum() function call.

if you are wanting, or expecting, a row for each invoice, then you need to
remove the where clause and the sum() alias and then loop through the result
set and add partpaidamount to a empty variable.

also, I just noticed that you are using double quotes in your statement.  I
have always had bad luck with using double quotes.  I would switch to single
quotes.

how are you getting the $invoiceid value?  is this code inside another a
larger loop?

Jim lucas

- Original Message -
From: "Ben C." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, August 04, 2003 10:33 PM
Subject: Sum a column of values from a MySQL query


> I am trying to sum a query of values from a MySQL table.  The code I am
> using is:
>
> ---BEGIN CODE #1--
> $sql_2 = "SELECT SUM(partpaidamount) as partpaid
> FROM $tb_name
> WHERE invoiceid = \"$invoiceid\"
> ";
>
> $result_2 = @mysql_query($sql_2,$connection) or die(mysql_error());
>
> while ($row = mysql_fetch_array($result_2)) {
> $invoicepartpaid = $row['partpaid'];
> }
> ---END CODE #2
>
> 1) The code returns the sum of a partially paid invoice.  The individual
> invoice is 'partpaid'. WORKS...NO PROBLEM
> 2) The while() then return a list of partially paid invoices which is
> $invoicepartpaid.  WORKS..NO PROBLEM
> 3) I then want to add the list of partially paid invoices
($invoicepartpaid)
> together.  I AM STUCK HERE ADDING THE INVOICES AMOUNTS TOGETHER.
>
> If anyone can help I would greatly appreciate it.
>
>
> --
> The content of this email message and any attachments are confidential and
> may be legally privileged, intended solely for the addressee.  If you are
> not the intended recipient, be advised that any use, dissemination,
> distribution, or copying of this e-mail is strictly prohibited.  If you
> receive this message in error, please notify the sender immediately by
reply
> email and destroy the message and its attachments.
>
>


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



Re: [PHP] Array to List

2003-08-14 Thread Jim Lucas
on page one do this instead.



Jim Lucas

- Original Message -
From: "James Johnson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 11, 2003 1:29 PM
Subject: RE: [PHP] Array to List


> All,
>
> Thanks for your help, but this shouldn't be so freaking hard to do. 
>
> 1) I have a multiple select input on one page that is populated with a
list
> of campuses. The user selects which campus(es) to search on.
> 2) the user submits the form and goes to the next page.
> 3) I want a list of the selected campus(es) at the top of the page
>
> Page 1
>  user sees this 
> Select Campus(es)
> ---
> Cal State San Bernardino
> University of Redlands
> University of California, Riverside
> Universtiy of California, San Diego
> *
> -- code --
> 
>  if(isset($_POST['Submit'])){
> $_SESSION['sv_CampusList']= implode( ', ', $_POST['campus'] );
> header("Location: " . "search.php");
> exit;
> }
> ?>
>
> Page 2
> 
> 
>  $cList = $_SESSION['sv_CampusList'];
> mysql_select_db($database_CCB, $CCB);
> $query_GetCampuses = "SELECT * FROM campuses WHERE inst_id IN
> ($cList) ORDER BY name ASC";
> $GetCampuses = mysql_query($query_GetCampuses, $CCB) or
> die(mysql_error());
> $row_GetCampuses = mysql_fetch_assoc($GetCampuses);
> $totalRows_GetCampuses = mysql_num_rows($GetCampuses);
> $c = implode( ', ', $row_GetCampuses );
> echo $c;
> ?>
>
> 
> Campuses: 
>
> * user is supposed to see this *
> Campuses: Cal State San Bernardino, University of Redlands
>
> I did check the MySQL table and inst_id is an integer. When playing around
> with the Query in PhpMyAdmin, I found that I needed to surround the values
> in the IN clause with single quotes.
>
> Perhaps I'm going about this the wrong way. Any advice or suggestions
would
> be appreciated.
> Thanks,
> James
> -Original Message-
> From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 11, 2003 1:12 PM
> To: James Johnson; 'Chris Boget'; [EMAIL PROTECTED]
> Subject: Re: [PHP] Array to List
>
>
> From: "James Johnson" <[EMAIL PROTECTED]>
>
> > Actually, I'm using $campusList for a SQL statement:
> >
> > SELECT name FROM campuses WHERE inst_id IN ('$campusList');
> >
> > It wasn't working until I found out that $campusList needs to look
> > like '1','2','3'.
> >
> > $campusList = implode( ', ', $_POST['campus'] );
> >
> > Returns 4,2,3 (whatever was selected)
> >
> > I've looked in the manual on implode, but don't see how to surround
> > each value with single quotes. Is there another function that will do
> > this?
>
> You don't need the quotes if the values are integers, but if you insist...
>
> $campusList = "'" . implode("','",$_POST['campus']) . "'";
>
> The implode "pattern" is a single quote, comma, single quote, then
surround
> the whole implode result by single quotes to complete it.
>
> ---John Holmes...
>
>
>
> --
> 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



Re: [PHP] Correct Coding

2003-08-14 Thread Jim Lucas
Good point.

Would not have seen it that way.

Thanks for the tip.

Jim Lucas
- Original Message -
From: "Roger B.A. Klorese" <[EMAIL PROTECTED]>
To: "'Jim Lucas'" <[EMAIL PROTECTED]>; "'Curt Zirzow'"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, August 07, 2003 11:03 AM
Subject: RE: [PHP] Correct Coding


> > Could you explain a little better why this would make things better?
> >
> > I don't understand how this would improve things.
>
>
> > > Concerning the $Task == "Add", I'd like to make a comment.  It can
> > > be a wise decision to compare your variables with strings like:
> > >
> > > if ("Add" == $Task)
> > >
> > > This can help preventing typo's  like:
> > >
> > > if ($Task = "Add")
>
> $Task = "Add" (typo'd for $Task == "Add") would assign the value,
> clearly not your intent.
>
> "Add" = $Task would be an illegal assignment to a constant, so your
> error would be detected.
>
>
>
> --
> 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



Re: [PHP] Frequent Mode Switching

2003-08-14 Thread Jim Lucas
This method has been my personal choice for the past 3-4 yrs in coding,

I have not found any problems with it thus far.

But I am gradually switching all my code over to a seperate template style
design as where I have all my values in a variable format and then parse a
*.html file and str_replace() all the values accordingly.

I have found no significant performance difference between , echo
"";, print()

But I have found a much cleaner method by using the templateing method that
I am switching to.

To sum it up, if you are concerned about performance, I wouldn't worry too
much.  But if you are worried about readability, I would stick with the  method myself.  It keeps everything flowing in the script.

Jim Lucas

- Original Message -
From: "Derrick Fogle" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 05, 2003 2:13 PM
Subject: [PHP] Frequent Mode Switching


> Thoughts on frequent switching in and out of PHP mode:
>
>  ?>Switch out, static HTML
>  ?>Switch out, more static HTML
>
> I've found that I prefer programming this way, for the most part,
> putting most of the heavy PHP programming at the top, and then using
> static HTML interspersed mostly with quick  statements
> for what users see.
>
> I'm sure there's more than one viewpoint out there, so I'd like to hear
> a couple of them. Is this frequent mode switching good, bad, or
> indifferent? Is there a point at which the mode switching starts to
> seriously degrade performance and reliability?
>
> -Derrick
>
>
> --
> 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



Re: [PHP] Function arguments

2003-08-15 Thread Jim Lucas
Most of my program functions use the first approach

I have what ever must be given because the nature of the functions only
exists because it does certain things.

I then have the last argurment passed be an array.  This will contain all
the data that I might want to use inside the function other then the
required fields.

for example I have a 'BOXTOP()' and 'BOXBOTTOM()' function set.

for the 'BOXTOP()' function I require the first argument but after that is
an array.

with this, I can customize the with of my box and if it isn't given it
defaults to a predefined with.

I can do the same thing with themes, colors, borders, cellpadding,
cellspacing, etc...

Then it will pass this same information to the corresponding 'BOXBOTTOM()'
function.

This keeps things very nice and clean.

inside the 'BOXTOP()' function is a mess, but once it is how you want it,
you will find that it is very easy to work with functions formated like
this.


Jim Lucas

- Original Message - 
From: "Hardik Doshi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 15, 2003 8:53 AM
Subject: [PHP] Function arguments


> Hi Group,
>
> I have a question on overloaded function.
>
> What is the best way to pass the arguments so it is
> easy to maintain in future if function behaviour
> changes by adding/removing one or more arguments?
>
> Currently i am passing arguments in array. But i think
> it is not the clean way to do it and another approach
> i am using is functionName(arg1, arg2='', arg3='') but
> here again i think it is not easy to maintain.
>
> Please let me know if you guys have other options or
> improved version of above options.
>
> Thanks
>
> Hardik
>
> __
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> -- 
> 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



Re: [PHP] How to open a save-as dialog and then redirect after donwload?

2003-08-19 Thread Jim Lucas
actually, you should be able to do this without ever leaving the page that
were clicking from.

if on the page that you are linking to, you add headers to force a download,
you should never actually GO to that page.  Your browser should realize that
it is something that it is suppose to download and then bring up the Save As
box.  This will make it so you never leave the page that you were on.

Jim Lucas


- Original Message - 
From: "Jean-Christian IMbeault" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 18, 2003 6:43 PM
Subject: [PHP] How to open a save-as dialog and then redirect after
donwload?


> I want to create the following:
>
> 1- A screen a series files and associated buttons
> 2- if the user clicks the button a "File | save as" dialog opens up
> 3- after the file the user is redirected to a new page
>
> I've gotten 1 and 2 to work but I can't figure out how to do anything
> after the file has finished downloading. I've tried header("Location: ")
> but that doesn't work because it must be used before any input is sent.
>
> The reason I want this functionality is that once a file is downloaded I
> want the screen with the buttons to refresh itself and remove the
> downloaded file from the list displayed to the user.
>
> How can I accomplish this? All suggestions welcomed!
>
> Jean-Christian Imbeault
>
>
> -- 
> 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



Re: [PHP] window.open("hai.php?id="one");

2003-08-19 Thread Jim Lucas
why don't you run this



Jim Lucas
- Original Message - 
From: "Martin Towell" <[EMAIL PROTECTED]>
To: "'murugesan'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, August 18, 2003 11:18 PM
Subject: RE: [PHP] window.open("hai.php?id="one");


> The same way you do any other variable passed in from a form...
>
> $_POST['id']
> or $HTTP_POST_VARS['id']
> or $id
>
> depending on your version of php and if you have register_globals on (for
> the last one)
>
> -Original Message-
> From: murugesan [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 19 August 2003 4:14 PM
> To: Martin Towell; [EMAIL PROTECTED]
> Subject: Re: [PHP] window.open("hai.php?id="one");
>
>
>
> I have made the value hidden. How can I retrieve it in the next page
in
> php.
>
> -murugesan
>
> - Original Message -
> From: "Martin Towell" <[EMAIL PROTECTED]>
> To: "'murugesan'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, August 19, 2003 11:21 AM
> Subject: RE: [PHP] window.open("hai.php?id="one");
>
>
> > Hiya,
> >
> > 1. Turn off the address bar
> >
> > or
> >
> > 2. Create a form with hidden elements, with method=post
> > open a window to a blank page, and name the window
> > submit the form to the newly, named, window
> >
> > HTH
> > Martin
> >
> > -Original Message-
> > From: murugesan [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, 19 August 2003 3:45 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] window.open("hai.php?id="one");
> >
> >
> > Hello all,
> > I need to pass a value from one page to another.This is done
from
> a
> > link from page 1 to page 2.
> > In that I called a php file as
> >
> > window.open("hai.php?id="one");
> > But I dont want ?id="one" to be displayed in the address bar.
> > How can I achieve this?.
> >
> > -murugesan.
> >
>
>
> -- 
> 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



Re: [PHP] Access denied problem, please help

2003-08-22 Thread Jim Lucas
how about giving the specs on all three servers?

So WE can see the differences.

Jim Lucas
- Original Message - 
From: "Ryan A" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 22, 2003 5:39 PM
Subject: [PHP] Access denied problem, please help


> Hi,
> I am trying to upload something into a directory on my server but always i
> am getting a permission denied ONLY from this server...i have tried it on
2
> other servers and they seem to be working fine but i have to get it
working
> on this server as this server is the fastest and our production server.
>
> I have looked at the folder permissions and CHMODED/changed them from 644
to
> 766 and finally 777 but am getting the same error, i then had a look at
the
> php info file (http://jumac.com/phpinfo.php) and i see file_uploading is
set
> to 1 and 1, safe mode is off, i am not too familier with file uploading so
> is this right? if not, how can i change it? hopefully via a .htaccess as I
> dont have access to the php.ini file directly.
>
> These are my paths:
> $UserUploadDir="/usr163/home/r/y/ryanknig/public_html/BWH-Ads-Images";
> $UserUploadURL = "http://jumac.com/BWH-Ads-Images";;
>
>
> Let me again point out that this problem only seems to be on this server,
> the scripts including the upload is working perfectly on the other test
> servers/sites.
>
> Kindly reply,
> -Ryan A.
>
>
>
> We will slaughter you all! - The Iraqi (Dis)information ministers site
> http://MrSahaf.com
>
>
>
> -- 
> 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



Re: [PHP] Access denied problem, please help

2003-08-23 Thread Jim Lucas
These are all converted into boulean once the config file is read.  So it
doesn't matter.

on = yes = 1 = true
off = no = 0 = false

And by what method are you uploading the files?

Can you show the Form and process scripts.  If they are large scripts,
please only include the sections that does the uploading.

Jim Lucas

- Original Message - 
From: "Ryan A" <[EMAIL PROTECTED]>
To: "Jim Lucas" <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 4:06 AM
Subject: Re: [PHP] Access denied problem, please help


> Oops sorry,
> Here are the phpinfo files of the other 2:
>
> bestwebhosters.com/phpinfo.php
> 321go.biz/phpinfo.php
>
> jumac.com/phpinfo.php
>
>
> I have noticed that in the other two phpinfo files that it shows
> file_uploads as "on" but in jumac it shows it as "1" which according to
the
> manual at the phpinfo site is the default, maybe i should change it to
"on"?
> but how via a .htaccess as i dont hvae accsess to the php.ini file...
>
> Thanks,
> -Ryan
>
>
> > how about giving the specs on all three servers?
> >
> > So WE can see the differences.
> >
> > Jim Lucas
>
>
> > > Hi,
> > > I am trying to upload something into a directory on my server but
always
> i
> > > am getting a permission denied ONLY from this server...i have tried it
> on
> > 2
> > > other servers and they seem to be working fine but i have to get it
> > working
> > > on this server as this server is the fastest and our production
server.
> > >
> > > I have looked at the folder permissions and CHMODED/changed them from
> 644
> > to
> > > 766 and finally 777 but am getting the same error, i then had a look
at
> > the
> > > php info file (http://jumac.com/phpinfo.php) and i see file_uploading
is
> > set
> > > to 1 and 1, safe mode is off, i am not too familier with file
uploading
> so
> > > is this right? if not, how can i change it? hopefully via a .htaccess
as
> I
> > > dont have access to the php.ini file directly.
> > >
> > > These are my paths:
> > > $UserUploadDir="/usr163/home/r/y/ryanknig/public_html/BWH-Ads-Images";
> > > $UserUploadURL = "http://jumac.com/BWH-Ads-Images";;
> > >
> > >
> > > Let me again point out that this problem only seems to be on this
> server,
> > > the scripts including the upload is working perfectly on the other
test
> > > servers/sites.
> > >
> > > Kindly reply,
> > > -Ryan A.
> > >
> > >
> > >
> > > We will slaughter you all! - The Iraqi (Dis)information ministers site
> > > http://MrSahaf.com
> > >
> > >
> > >
> > > -- 
> > > 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
> >
>
>


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



Re: [PHP] Random selection

2003-08-23 Thread Jim Lucas
Try this:

SELECT name FROM table GROUP BY name ORDER BY RAND() LIMIT 3

This will group together all the names and then choose from a list that has
only unique names and then return 3 at random.

Jim Lucas

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 6:06 AM
Subject: [PHP] Random selection


> Hi,
>
> Can you help me with this one??
>
> In my mysql db i have a colum called names;
>
> In names their are:
>
> Frank
> Frank
> Bob
> Alice
> Bob
> Alice
> Jim
> Alice
> Frank
>
> I want to make a random selection (max 3 value's for example).. Only it
may not produce two times the same name. For example;
>
> This is the output:
>
> Frank, Jim, alice
>
> Wrong output
>
> Frank, Frank, Jim
>
> Please help!
>
> Thanks,
>
> Frank
>
>
>






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



Re: [PHP] Help with a script

2003-08-23 Thread Jim Lucas
what is the source for the page that you initially enter the data on the web
form look like?

Jim Lucas
- Original Message - 
From: "Stevie D Peele" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 6:25 AM
Subject: [PHP] Help with a script


> I've been working on a script for quite some time now, particulary a site
> news script. Heres how it works
>
> 1. Information is passed from a form to the database
> 2. Table is selected to a page to be viewed by the general public.
>
> The problem is, when I use the form, there are no errors in the script,
> but nothing is entered into the database.
>
> Here are my scripts
> The
> Query
> CREATE TABLE SiteNews
> (
> Alias varchar(50) NOT NULL default '0',
> News BLOB NOT NULL,
> NewsDate Date NOT NULL
> ) TYPE=MyISAM
> -
> -
>
> form
> action
>  include ('config.php');
> $link = @mysql_pconnect($location, $username, $password)
>   or die("Could not connect to the databaseserver. Please go back and
> try again or try again later.");
> @mysql_select_db($database, $link)
>   or die ("Could not select database. Please go back and try again or
> try again later.");
> $sql_insert = "INSERT INTO SiteNews ('Alias','News','NewsDate')
> VALUES ('". addslashes($_POST['newsperson']) . "','" .  $_POST['date']  .
> "','" .  addslashes($_POST['thenews']) . "')";
>
> $result = mysql_query($sql_insert, $link);
> echo (mysql_affected_rows($link) . " News entry inserted");
> ?>
> -
> -
>
> Viewing the news
> script---
>  include ('config.php');
> $link = @mysql_pconnect($location, $username, $password)
>  or die("Could not connect to the databaseserver. Please go back and
> try again or try again later.");
> @mysql_select_db($database,$link)
>  or die ("Could not select database. Please go back and try again or
> try again later.");
> $sql = "SELECT Alias, NewsDate, News FROM SiteNews ORDER BY NewsDate
> DESC";
> $news = mysql_query($sql,$link) or die(mysql_error().''.$sql.'');
>
> if ($news){
>if (mysql_num_rows($news)== 0){
>  echo ("No newsitems found.");
>}
>else{
>  while ($row = mysql_fetch_assoc($news)){
>   echo("");
>   echo($row['Alias']. "");
>   echo($row['NewsDate']."");
>   echo($row['News']);
>   echo("");
>   echo("");
> }
>   }
> }
> else{
>echo("Queryproblem");
> }
>
>  ?>
> -
> -
>
> Can anyone see what is wrong??
>
> Thanks


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



Re: [PHP] user-defined superglobals?

2003-08-23 Thread Jim Lucas
I have been wanting the same thing, but I too have not found a solution, and
do not know if it will come around.

Being able to create your own super-global would be a very nice feature.

Jim Lucas
- Original Message - 
From: "Matthias Nothhaft" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 11:44 AM
Subject: Re: [PHP] user-defined superglobals?


> Sorry this all is not what I'm looking for.
> I see it is not possible at the moment.
>
> It would be nice to have a php-function like
>
> declare_superglobal($_MYFRAMEWORK);
>
> And then use $_MYFRAMEWORK like $_GET.
>
> Thanks nevertheless.
>
> Regards,
> Matthias
>
> Ray Hunter wrote:
> >>Well, this is clear, (I'm only new in the list - not in PHP ;-) )
> >>but I want it in a better/shorter way
> >>for the "master var" of a big project!
> >
> >
> > Yes you can set up a master file that includes all your master
> > vars...many php developers call this a configuration script and name it
> > config.php.
> >
> > This allows users to set up global variables that are used through out
> > the application.
> >
> >
> >>Is there a way to request such a feature and where?
> >>I think this would be nice for application frameworks!?
> >>Maybe also for PEAR...
> >
> >
> > There are implementations of this all thru PEAR.
> >
> > --
> > BigDog
> >
> >
> >
>
>
>
> -- 
> 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



Re: [PHP] file upload problem

2003-08-23 Thread Jim Lucas
when you are uploading files via a form, you must use the POST method.

Jim Lucas
- Original Message - 
From: "Matthias Wulkow" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 11:16 AM
Subject: [PHP] file upload problem


> Hi ,
> 
> I try to upload a file with such an input type = 'file' field.
> My form looks like:
> 
> echo " = 'multipart/form-data'>\n"; 
> 
> ...
> 
> echo " accept='text/*'>\n"; 
> 
> ...
> 
> echo " 'ändern'>\n";
> 
> echo "\n";
> 
> After submition, I can't find the file on the server. Nowhere.
> In php.ini, I have /tmp as upload-directory.
> 
> I'm using apache2 on linux.
> 
> Can somebody tell me why the file is not uploaded?
> 
> Thx for answering
> 
> SvT
> 
> 
> -- 
> Who is the ennemy?
> 
> 
> -- 
> 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



Re: [PHP] file upload problem

2003-08-23 Thread Jim Lucas
- Original Message - 
From: "Matthias Wulkow" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "Jim Lucas" <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 12:27 PM
Subject: Re: [PHP] file upload problem


> Hallo Jim,
>
> am Samstag, 23. August 2003 um 21:16 hast Du Folgendes gekritzelt:
>
> JL> when you are uploading files via a form, you must use the POST method.
>
> well, I tried the example from
http://de.php.net/manual/de/features.file-upload.php#features.file-upload.post-method
> and that doesn't work neither... no files are uploaded...
>
>
> SvT
>
> PS: In between I tried with POST and no success
>
>
>
> -- 
> Who is the ennemy?
>
> mailto:[EMAIL PROTECTED]
>
>

how are you checking to see if the files are getting uploaded?

Jim Lucas

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



Re: [PHP] file upload problem

2003-08-23 Thread Jim Lucas
ok.  the key here then is that php is going to erase the uploaded file after
the script has finished processing.

What you have to do is move the file to a different location before the
script ends.

This is the normal behavor for PHP.

More then likely the file is getting transmitted to the server, but when the
script ends php automatically does some cleanup and erases any leftover
files.  Since you didn't move the file, it thinks that it is leftover and
just erases it.

Try moving the file or renaming it in some mannor and you will notice that
the file stays on the server even after the script ends.

Jim Lucas
- Original Message - 
From: "Matthias Wulkow" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "Jim Lucas" <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 12:43 PM
Subject: Re: [PHP] file upload problem


> Hallo Jim,
>
> am Samstag, 23. August 2003 um 21:32 hast Du Folgendes gekritzelt:
>
>
> JL> how are you checking to see if the files are getting uploaded?
>
> JL> Jim Lucas
>
>
> I'm looking in /tmp for new files... but there are none. I'm also
> looking in the Apache-RootDirectory. No files neither.
>
> SvT
>
>
>
> -- 
> Who is the ennemy?
>
> mailto:[EMAIL PROTECTED]
>
> -- 
> 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



Re: [PHP] Problem with the post variables.

2003-08-23 Thread Jim Lucas
You  need to take a second look at the way you are refering to the
varialbles in the process page.

You are using the POST method in the method='POST' in the form, but on the
process page you are refering to it via $_GET['...']  change this to
$_POST['...'] and you should be fine.

Jim Lucas
- Original Message - 
From: "chris" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 1:34 PM
Subject: Re: [PHP] Problem with the post variables.


> On Mon, 18 Aug 2003 18:35:09 +0200, Wouter Van Vliet <[EMAIL PROTECTED]>
> wrote:
>
> > The problem is probably in the 'enctype="multipart/form-data"'. You
> > should
> > only use this enctype if you're gonna upload a file through the form. If
> > not, just leave it away or use text/plain
> >
> > Wouter
>
> Why would that be the problem?  Regardless of the enctype, it should still
> create POST/GET data for whatever else was in the form.  Yes,
> multipart/form-data *should* only be used if they are uploading a file.
> That doesn't mean PHP should ignore additional POST/GET data from the
> form, which it has had a history of doing, depending on which way the wind
> blows or the price of tea in China.
>
> > -Oorspronkelijk bericht-
> > Van: Klaus Kaiser Apolinário [mailto:[EMAIL PROTECTED]
> > Verzonden: maandag 18 augustus 2003 16:04
> > Aan: [EMAIL PROTECTED]
> > Onderwerp: [PHP] Problem with the post variables.
> >
> >
> > Guys I have a problem here.
> > I'm using PHP 4.3.2 and httpd 1.3.28.
> > Look my exemple.
> > I have a page whith a Form method post, and I submit this page to
> > teste2.php, but I dont can request de data from the text box...
> >
> >
> > ###
> > This is the test page
> >
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> > #
> > Teste2.php
> >
> >  > $string = $_POST['texto'];
> > echo "Var em post: ".$string."";
> > echo "Var em get: ".$_GET['texto']."";
> >
> >
> > //phpinfo();
> > ?>
> > 
> >
> > Some one can help me...???
> >
> > Klaus Kaiser Apolinário
> > Curitiba online
> >
> >
>
>
>
> -- 
> Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
>
> -- 
> 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



Re: [PHP] Tips on print to screen debugging

2003-08-23 Thread Jim Lucas
it is your  tag.  You are missing the closing '>' on the openning
title tag.

Fix that and see what happens

Jim Lucas
- Original Message - 
From: "Gloria L. McMillan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 2:00 PM
Subject: Re: [PHP] Tips on print to screen debugging


> Here is the URL of the poll form.
> http://dakotacom.net/~glomc/forms/CAT.html
>
> When you do this poll it immiediately attempts to print to screen.
> There's also a "VIEW RESPONSES" button so ppl don't have to
> answer the poll to view reponses.  You can see now that there
> is just a little jumble of letters at upper left of the screen.
>
> Something is wrong in the .php file.
>
> One member of this group gave a working routine to me to
> choose among three select calls for the display.  Maybe that has
> been corrupted by losing a letter or something.  I cut and paste
> new forms off the old.
>
> I am willing to send the .php file backchannel.  I have deleted the
personal
> addresses from it.
> Thanks,
>
> Gloria
>
> "John W. Holmes" wrote:
>
> > Gloria L. McMillan wrote:
> >
> > > I have always had problems in cutting and pasting new forms off old
ones.
> > > Often the problem is in the communication that makes the form allow
repliers
> > > to view results on screen.  This is good to do with opinion polls to
start
> > > discussions.
> > >
> > > I have a *terrible* time locating the source of the error.
> > >
> > > Do experienced .php users have a method for finding errors in the
print
> > > to screen?
> > >
> > > I will send the culprit .php file to anybody who is willing to look it
over.
> >
> > This is a pretty vague question. Provide some more detail as to the
> > exact problem that you're having, post a bit of the relavant file, and
> > the exact error message. :)
> >
> > --
> > ---John Holmes...
> >
> > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> >
> > PHP|Architect: A magazine for PHP Professionals - www.phparch.com
>
> -- 
> 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



Re: [PHP] include () problems

2003-08-25 Thread Jim Lucas
If you are having a problem that tells you that output was displayed on a
given line in a given file.  And you found this because after the output you
tried sending headers, then look in that file on that given line, and you
will see the problem.

It could be a simple as a

?>


To: <[EMAIL PROTECTED]>
Sent: Monday, August 25, 2003 12:56 AM
Subject: [PHP] include () problems


> Hi,
>
> When I run the line:
>
> include ("fnord.php");
>
> with the file looking like:
>
>  define ("fnord_included", true);
> function fnord ($arg = true) {
>
> // 450 lines
> return $msg;
>
> }
> ?>
>
> it prints out the return of fnord() (i.e. $msg).  I've checked, and
there's
> no echo or print statemetns anywhere...
>
> Oh, yeah, FYI, the pattern goes like this:
>
> file: index.php
> 
> file: standard.php
>  ("Content-type: text/html; encoding=utf-8"); ?>
>
> and it prints it right up the top of index.php, causing an error with the
> "header" statement (although it says the error is in fnord.php - which
> contains NO header statemtns).
>
> ideas?
>
> Regards,
>
> mjec
>
> -- 
> 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



Re: [PHP] if seat is sold

2003-08-26 Thread Jim Lucas
on a side note, you realize that you could loose all all of the while loops
and replace them with two or three nested foreach() loops?

Build yourself one big array and loop through it.

If you need any advice, drop me a note.

Jim Lucas

- Original Message - 
From: "Jay Fitzgerald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 25, 2003 6:23 PM
Subject: [PHP] if seat is sold


> 1. here is my code:  http://codedump.phpfreaks.com/viewcode.php?id=1162
> 2. here is a screenie of my seating chart:
http://www.bayou.com/jay/chart.gif
>
> 3. what i am wanting to do is using CSS i want to "strike-through" the
> seats that are in the db - else, I want them to display normally
>
> note: the seat numbers are not in the db unless someone chooses that
> seatthey are a while loop of numbers 1 through 240
>
> Anyone got any ideas?
>
> -- 
> 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



Re: [PHP] if seat is sold

2003-08-26 Thread Jim Lucas
here is that code I talked about


 

";
  } else {
echo "";
echo "";
echo $alphabet[($i / $rowCount)];
echo "";
echo "";
  }

  if(in_array($val, $taken)) {
echo "{$val}";
  } else {
echo " {$val}";
  }

  if($i % $rowCount + 1)
echo "";
  else
    echo "";

}
echo "";
?>

Give it a run and let me know what you think.


Jim Lucas

- Original Message - 
From: "Jay Fitzgerald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 25, 2003 6:23 PM
Subject: [PHP] if seat is sold


> 1. here is my code:  http://codedump.phpfreaks.com/viewcode.php?id=1162
> 2. here is a screenie of my seating chart:
http://www.bayou.com/jay/chart.gif
>
> 3. what i am wanting to do is using CSS i want to "strike-through" the
> seats that are in the db - else, I want them to display normally
>
> note: the seat numbers are not in the db unless someone chooses that
> seatthey are a while loop of numbers 1 through 240
>
> Anyone got any ideas?
>
> -- 
> 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



Re: [PHP] Working with dates

2003-03-17 Thread Jim Lucas
you do that same query in mysql

Jim
- Original Message -
From: "Joshua Moore-Oliva" <[EMAIL PROTECTED]>
To: "Brad Harriger" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Monday, March 17, 2003 10:49 AM
Subject: Re: [PHP] Working with dates


> Switch to postgres!  then you can do
>
> SELECT stamp FROM table
>   WHERE stamp BETWEEN timestamp 'today' AND timestamp 'tomorrow';
>
> On March 17, 2003 12:43 pm, Brad Harriger wrote:
> > I have two variables, $StartDate and &EndDate that contain values read
> > from MySQL Date fields.  How can I determine if a value entered by the
> > user is between the two dates?  I'm using PHP 4.0.6.
> >
> >
> > Thanks in advance,
> >
> > Brad
>
>
> --
> 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



Re: [PHP] Question about a text file and foreach

2003-03-18 Thread Jim Lucas
You need to split() the variable ($mboxs)  on newlines "\n"

Jim

- Original Message -
From: "Jim Greene" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 18, 2003 8:22 AM
Subject: [PHP] Question about a text file and foreach


> Hi All,
> I have a text file that has entries like the following:
> user1:mbox1:
> user1:mbox2:
>
> I basically do: $mboxs = `cat file | grep user1 | cut -d: -f2';
> I then want to print out the data in the $mboxs variable (array)
> I am trying to use foreach but it does not work..  I am assuming the data
is not considered an array?
> Any help would be appreciated.. Thanks
> Jim
>
>
>
> --
> 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



Re: [PHP] php and javascript

2003-03-18 Thread Jim Lucas
you are trying to include a variable inside a single quoted string.

change the echo line to this.

echo "  window.location = '$thepage'>
";

Jim
- Original Message -
From: "Antoine" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Tuesday, March 18, 2003 2:52 PM
Subject: [PHP] php and javascript


> I wrote a function to redirect my page to another one.   But for some
> reason I keep getting an error.
> here is the function I made
>
> function js_pointer_login($thepage)
> {
>  echo '  window.location = '$thepage'
> ';
> }
>
>
> --
> Antoine <[EMAIL PROTECTED]>
>
>
> --
> 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



Re: [PHP] where is cookie limitation on php ?

2003-03-21 Thread Jim Lucas
Look up the specs on the limitation of cookies and you will then know the
limitation of php when it comes to cookies.

Jim
- Original Message -
From: "Hatem Ben" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 21, 2003 9:10 AM
Subject: [PHP] where is cookie limitation on php ?


> Greetings all,
>
> Can someone tell me where is the limitation on the number/size of cookies
> that could be used ?
>
> Assuming we have :
>  $table = array("a","b","c","d");
> $table = array_pad($table, 20,"e");
> while (list($key, $value) = each ($table)) {
>  setcookie( "DX_A[$key]", $value );
> }
> setcookie( "DX_B", "test 1" );
> setcookie( "DX_C", "test 2" );
> setcookie( "DX_D", "test 3" );
> setcookie( "DX_E", "test 4" );
> print_r($_COOKIE);
> ?>
>
> This is what php return :
> Array
> (
> [DX_A] => Array
> (
> [4] => e
> [5] => e
> [6] => e
> [7] => e
> [8] => e
> [9] => e
> [10] => e
> [11] => e
> [12] => e
> [13] => e
> [14] => e
> [15] => e
> [16] => e
> [17] => e
> [18] => e
> [19] => e
> )
>
> [DX_B] => test 1
> [DX_C] => test 2
> [DX_D] => test 3
> [DX_E] => test 4
> )
>
> The first values are truncated !
>
> Thanks,
> Hatem
>
>
> --
> 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



Re: [PHP] variales within define constants

2003-03-22 Thread Jim Lucas
yes, you can do this, but you have the order wrong.

you must set the variable before you use it.

and you must have double quotes around the variable in the define() call

single quotes denotes a literal string which will not include the value of a
variable, you would end up echo'ing  "Hello $var" instead of "Hello Dan"

$var = "Dan";

define('CONSTANT', "Hello $var");

echo CONSTANT

Jim Lucas

- Original Message -
From: "Dan Rossi" <[EMAIL PROTECTED]>
To: "Daniel Diehl" <[EMAIL PROTECTED]>; "'Php-General'"
<[EMAIL PROTECTED]>
Sent: Saturday, March 22, 2003 4:44 AM
Subject: RE: [PHP] variales within define constants


> ?? why would i not try it before posting heh :O
>
> -Original Message-
> From: Daniel Diehl [mailto:[EMAIL PROTECTED]
> Sent: Sunday, March 23, 2003 12:23 AM
> To: 'Dan Rossi'; 'Php-General'
> Subject: RE: [PHP] variales within define constants
>
>
> Just try it :)
>
> > -Original Message-
> > From: Dan Rossi [mailto:[EMAIL PROTECTED]
> > Sent: Samstag, 22. März 2003 08:09
> > To: Php-General
> > Subject: [PHP] variales within define constants
> >
> >
> > hi guys i'm sure i've done this before but is it possible ?
> >
> > i would like it to show up like this
> >
> > define('CONSTANT','Hello $var');
> >
> > $var = "Dan";
> >
> > echo CONSTANT
> >
> > --
> > 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
>
>
> --
> 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



Re: [PHP] Separators in variable values causing MySQL commands to fail

2003-03-22 Thread Jim Lucas
you must remove the backticks.

Jim
- Original Message - 
From: "rentAweek Ltd" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 22, 2003 9:50 AM
Subject: [PHP] Separators in variable values causing MySQL commands to fail


> In my PHP script I have coded e.g.:
> 
> $sql = "INSERT INTO `$owners` ( `FirstName`, `LastName`) VALUES ( 
> '$firstname' , '$lastname' )";
> 
> $result = mysql_query($sql);
> 
> So along comes e.g. John O'Groats and nothing gets inserted into the 
> database.
> 
> OK, I can bypass my oversight by stripping out apostophes from the 
> variable values. There has to be a better way please.
> 
> TIA
> 
> Mike
> 
> 
> -- 
> 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



Re: [PHP] Separators in variable values causing MySQL commands to fail

2003-03-22 Thread Jim Lucas
and , you need to escape the values that you are inputing
ie.  htmlspecialchars() or htmlentities() those values

Jim
- Original Message - 
From: "rentAweek Ltd" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 22, 2003 9:50 AM
Subject: [PHP] Separators in variable values causing MySQL commands to fail


> In my PHP script I have coded e.g.:
> 
> $sql = "INSERT INTO `$owners` ( `FirstName`, `LastName`) VALUES ( 
> '$firstname' , '$lastname' )";
> 
> $result = mysql_query($sql);
> 
> So along comes e.g. John O'Groats and nothing gets inserted into the 
> database.
> 
> OK, I can bypass my oversight by stripping out apostophes from the 
> variable values. There has to be a better way please.
> 
> TIA
> 
> Mike
> 
> 
> -- 
> 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



Re: [PHP] counting ..

2003-03-25 Thread Jim Lucas
when it comes to the second page, you already know that page you are on
1,2,3,4...

take that and multiply it by the defined number of results per-page, then
start your counting.

Jim
- Original Message -
From: "Sebastian" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Monday, March 24, 2003 10:09 PM
Subject: [PHP] counting ..


> Hello all.
>
> rather dumb question.
>
> I have a pagination system, 25 results per page, which are user comments,
I
> want to put a number on each comment so i am doing something like:
>
> $num=$num + 1;
> $number = $num;
> echo $number;
>
> But when i switch to the next 25 results it starts counting from 1 again,
> LoL.
>
> So i have to use $_GET right? If so can someone give me an example.
>
> Thanks in advanced.
>
>
> cheers,
> - Sebastian
>


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



Re: [PHP] foreach statement

2003-03-25 Thread Jim Lucas
i have this little function that I wrote to do just that.

function alternate(&$a, $b)
{
  return($a = ($a?$a:$b) );
}

just call it like this

alternate($myArr, array());
foreach($myArr AS $k => $v)
{
  do something here
}

Jim
- Original Message -
From: "Jennifer Goodie" <[EMAIL PROTECTED]>
To: "shaun" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 3:34 PM
Subject: RE: [PHP] foreach statement


> You don't.
> From http://www.php.net/manual/en/control-structures.foreach.php
> "Note: foreach does not support the ability to suppress error messages
using
> '@'."
>
> You should check the validity of your argument before passing it to
foreach
>
> if(is_array($array)){
> foreach($array as $key=>$val){
> //do stuff
> }
> }
>
> -Original Message-
> From: shaun [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 25, 2003 3:23 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] foreach statement
>
>
> how do i surpress an error message for a foreach statement?
>
>
>
> --
> 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
>
>


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



Re: [PHP] Session Theft

2003-03-28 Thread Jim Lucas
check into forcing the use of trans_sid

Jim
- Original Message -
From: "Haseeb Iqbal" <[EMAIL PROTECTED]>
To: "PHP General list" <[EMAIL PROTECTED]>
Sent: Friday, March 28, 2003 8:48 PM
Subject: [PHP] Session Theft


> i just want to figure out a way by which i can stop session theft.i
thought
> if i can get something from user end that is unique for that user.for e.g.
> his/her IP .but it will not work when they are behind firewall.they will
be
> assigned same IP.is there a way for me to get the IP (e.g.202.202.202.202
> thats just an e.g. ) plus computer ip(192.168.0.1 e.g.) i saw once a java
> chat server do this.if we can do this then it will help us (SOMEWHAT).
>
> if anyone has better suggestion just let me know
> Haseeb
>
> --
> 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



Re: [PHP] Grid edit form

2003-03-28 Thread Jim Lucas
This is untested, but I seem to recall doing something like this on a
project last year.























and on the process page you will receive an array called row that has
everything in it that you need.

Jim

- Original Message -
From: "Daniel Harik" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 28, 2003 10:20 AM
Subject: [PHP] Grid edit form


> Hello guys,
>
> I'm trying to make grid form that will allow to edit 60 rows at the same
> time, it's not hard to make a loop that would go from 0 to 59, but
> my problem is that i don't know what rows to update as i see no way to
find
> row's id after form is submitted.
>
> Thank You Very much.
>
>
> --
> 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



Re: [PHP] Grid edit form

2003-03-28 Thread Jim Lucas
you missunderstood my example then.

then 1,2,3,4,...  is only for the array, you wont be setting that with the
result set from the db call.  the id from the db call with be the value of
row[1][id] on the process page.

just think of it as a multidia indexed array

Jim
- Original Message -
From: "Daniel Harik" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 28, 2003 10:54 AM
Subject: Re: [PHP] Grid edit form


> Jim Lucas wrote:
>
> > This is untested, but I seem to recall doing something like this on a
> > project last year.
> >
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> Thank you for your reply, but i'm pulling records from db, and
> ids won't be 1,2,3,4..n, but more random.
>
> --
> 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



Re: [PHP] Grid edit form

2003-03-28 Thread Jim Lucas
you don't understand how this works then...

Jim
- Original Message -
From: "Ford, Mike [LSS]" <[EMAIL PROTECTED]>
To: "'Daniel Harik'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, March 28, 2003 9:44 AM
Subject: RE: [PHP] Grid edit form


> > -Original Message-
> > From: Daniel Harik [mailto:[EMAIL PROTECTED]
> > Sent: 28 March 2003 18:55
> >
> > Jim Lucas wrote:
> >
> > > This is untested, but I seem to recall doing something like
> > this on a
> > > project last year.
> > >
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > >
> > Thank you for your reply, but i'm pulling records from db, and
> > ids won't be 1,2,3,4..n, but more random.
>
> Doesn't matter, so long as they are unique -- they don't have to be
> sequential, or even in order.  Just use foreach on the row array to
iterate
> over the keys that are there.
>
> Cheers!
>
> Mike
>
> -
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
>
> --
> 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



  1   2   3   4   5   6   7   8   9   10   >