RE: [PHP] inserting preexisting image inside dynamic image

2002-11-24 Thread Martin Towell
try these: ImageCopy*()

-Original Message-
From: Eric Pierce [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 25, 2002 2:57 PM
To: [EMAIL PROTECTED]
Subject: [PHP] inserting preexisting image inside dynamic image


Hi there...

Just wondering... when creating a dynamic image, is
there a way/fuction to insert an existing image using
x,y coordiantes for precision?

I'm trying to make a statistical graph script using
some nice looking graphics.

Thanks for any tips!
Eric 

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.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] Disable refresh?

2002-12-01 Thread Martin Towell
no, no way to disable and no variable to say a refresh happened

one way to get around it is to submit to the page that does the update, then
get that page to do a header("location...") to another page. When the user
refreshes, they'll only refresh the last page, and not the updating page.

HTH
Martin

-Original Message-
From: Larry Brown [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 02, 2002 12:33 PM
To: PHP List
Subject: RE: [PHP] Disable refresh?


If not, is there a variable that provides information that a refresh
occurred to load the page?

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-Original Message-
From: Larry Brown [mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 01, 2002 8:23 PM
To: PHP List
Subject: [PHP] Disable refresh?

Anyone know of a method of preventing a user from refreshing a page.  I get
multiple updates with the same information in my database...

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

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




RE: [PHP] select * From ????

2002-12-15 Thread Martin Towell
can you post some more of your code? I think, if it's not too big, the
entire while loops

Martin


-Original Message-
From: Bruce Levick [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 9:45 AM
To: [EMAIL PROTECTED]
Subject: [PHP] select * From 


Hi,
Am just a newbie at this and was going great until I have hit this smell
snag.

I am connecting to mysql and all works well there. I query a table
"Illustrations" ($query = "SELECT * FROM Illustrations";), and want to
print the values of two columns ("titletext" & "img")within each row as
the request loops.

Print "$row[titletext]";
Print "$row[img]";

The code inplace seems all ok, but for some reason I am only being
returned the value of "titletext" and not also the value of "img". Am I
to be setting a new value for returning the info within "img"?? (eg
$row2).

I am sorry if this is hard to understand and also a silly Q, I am two
days into learning this stuff. All I want to do is to return these two
values from within the table. "titletext" and "img". They are both text
fields.

Cheers


  


-- 
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] select * From ????

2002-12-15 Thread Martin Towell
Looks good to me, but as Peter said, see if you really are getting something
in ['img']
try print_r($row) or var_dump($row) to make sure

-Original Message-
From: Bruce Levick [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 10:01 AM
To: Martin Towell
Subject: RE: [PHP] select * From 


Here is the display code that I started with.

Error performing query: " .
 mysql_error() . "");
exit();
  }


  // Display the text of each joke in a paragraph
  while ( $row = mysql_fetch_array($result) ) {
print"$row[titletext]";
print"$row[img]";
  }


?>

Not sure why it only displays just the titletext.

-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]] 
Sent: Monday, December 16, 2002 8:47 AM
To: Bruce Levick; [EMAIL PROTECTED]
Subject: RE: [PHP] select * From 


can you post some more of your code? I think, if it's not too big, the
entire while loops

Martin


-Original Message-
From: Bruce Levick [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 9:45 AM
To: [EMAIL PROTECTED]
Subject: [PHP] select * From 


Hi,
Am just a newbie at this and was going great until I have hit this smell
snag.

I am connecting to mysql and all works well there. I query a table
"Illustrations" ($query = "SELECT * FROM Illustrations";), and want to
print the values of two columns ("titletext" & "img")within each row as
the request loops.

Print "$row[titletext]";
Print "$row[img]";

The code inplace seems all ok, but for some reason I am only being
returned the value of "titletext" and not also the value of "img". Am I
to be setting a new value for returning the info within "img"?? (eg
$row2).

I am sorry if this is hard to understand and also a silly Q, I am two
days into learning this stuff. All I want to do is to return these two
values from within the table. "titletext" and "img". They are both text
fields.

Cheers


  


-- 
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] undefined index....property.

2002-12-16 Thread Martin Towell
you didn't send the code snippet for "Undefined index"
however, I think the reason you're getting these errors at home is because
you have a different error_reporting level.

HTH a bit
Martin

[snip]

//filled out info and clicked send.

Notice: Undefined index: license in c:\inetpub\wwwroot\php\config.php on
line 51

Notice: Undefined property: num_rows in
c:\inetpub\wwwroot\php\adcjoin.php on line 67


//

[snip]

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




RE: [PHP] Plz help to solve my problem.

2002-12-16 Thread Martin Towell
>From this error

Warning: Failed to write session data (files). Please verify that the
current setting of session.save_path is correct (/tmp) in Unknown on line 0

It looks like you'll have to change php.ini to have session.save_path point
to a valid path. Maybe \temp\  ?

HTH
Martin

-Original Message-
From: Elaine Kwek [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 17, 2002 4:08 PM
To: PHP
Subject: [PHP] Plz help to solve my problem.


I am now trying to use php session control in my web application. i try to
copy a coding an test it...but it come out error. i not sure how to solve
it. Plz help me...I using Apache server.

the code sample is like this:

";

?>


And this is the result of the page:

Warning: open(/tmp\sess_c0fe7c6a4524488a979e20d90b2eebb2, O_RDWR) failed: No
such file or directory (2) in c:\Program Files\Apache
Group\Apache\htdocs\Office_Management_System\tmp\page1.php on line 3

The content of $sess_var is Hello world!

Warning: open(/tmp\sess_c0fe7c6a4524488a979e20d90b2eebb2, O_RDWR) failed: No
such file or directory (2) in Unknown on line 0

Warning: Failed to write session data (files). Please verify that the
current setting of session.save_path is correct (/tmp) in Unknown on line 0


thanx to whom reply to me...

Elaine Kwek


-- 
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 / unix functions

2002-12-17 Thread Martin Towell
the only other way I know is to use: $output = `$cmd`;  (ie, backticks)

-Original Message-
From: Greg [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 1:27 PM
To: [EMAIL PROTECTED]
Subject: [PHP] php / unix functions


Hi-
Is there a built in way, besides using exec and system, to get the output
from commands like 'uptime' and 'df' on a linux system?  Thanks!
-Greg



-- 
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 / unix functions

2002-12-17 Thread Martin Towell
in that case, try passthru()

-Original Message-
From: Greg [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 1:45 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] php / unix functions


I just want to display the output of 'uptime' and 'df' on a php page
/Greg

"Andy Turegano" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Well, what do you want them to do?
>
>
> On Wed, 18 Dec 2002, Martin Towell wrote:
>
> > the only other way I know is to use: $output = `$cmd`;  (ie, backticks)
> >
> > -Original Message-
> > From: Greg [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, December 18, 2002 1:27 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] php / unix functions
> >
> >
> > Hi-
> > Is there a built in way, besides using exec and system, to get the
output
> > from commands like 'uptime' and 'df' on a linux system?  Thanks!
> > -Greg
> >
> >
> >
> > --
> > 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] Where am I?

2002-12-17 Thread Martin Towell
try doing a phpinfo() , somewhere in there it'll tell you

Martin

-Original Message-
From: Jeff [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 2:34 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Where am I?


I'm using PHP 4.0.6. I am developing on Win98SE, and deployed on an Apache
server.

I need to find the actual path of the root directory.

Windows: C:/Inetpub/wwwroot/
Apache: /home/dcent/public_html/

I've tried dirname(), basename(), etc. I just can't figure it out.
Help.

Jeff



-- 
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 am I?

2002-12-17 Thread Martin Towell
Doing a quick scan through the output of phpinfo() on my machine, I can see
any one of the following will give me the path (incl. filename of the
current script)

$HTTP_SERVER_VARS["DOCUMENT_ROOT"] . $PHP_SELF
$HTTP_SERVER_VARS["SCRIPT_FILENAME"]
$HTTP_SERVER_VARS["PATH_TRANSLATED"]

HTH
Martin

-Original Message-
From: Jeff [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 3:00 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Where am I?


No, I've been looking all day. I can get the information is I run the script
from the root, but what if I am in a sub-dir?
Jeff

"Martin Towell" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> try doing a phpinfo() , somewhere in there it'll tell you
>
> Martin
>
> -Original Message-
> From: Jeff [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 18, 2002 2:34 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Where am I?
>
>
> I'm using PHP 4.0.6. I am developing on Win98SE, and deployed on an Apache
> server.
>
> I need to find the actual path of the root directory.
>
> Windows: C:/Inetpub/wwwroot/
> Apache: /home/dcent/public_html/
>
> I've tried dirname(), basename(), etc. I just can't figure it out.
> Help.
>
> Jeff
>
>
>
> --
> 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] test

2002-12-17 Thread Martin Towell
na! didn't work :) 

-Original Message-
From: Roger Lewis [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 4:59 PM
To: Php-General
Subject: [PHP] test


This is a test. 


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

2002-12-17 Thread Martin Towell
actually, I get the same error. I've been putting it down to someone
subscribing and now their email is invalid.

BTW: I'm emailing to [EMAIL PROTECTED] - if that helps

-Original Message-
From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 5:12 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] test


Roger,
Are you emailing or posting to the news group?
John

Roger Lewis wrote:

> But it did!  Otherwise I wouldn't have received your comment. Why did I
get
> this message from Mailer-Daemon:
>
> Sorry. Your message could not be delivered to:
>
> php-list,emc (The name was not found at the remote site. Check that the
> name has been entered correctly.)
>
> -Original Message-
> From: Martin Towell [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 17, 2002 10:02 PM
> To: Php-General
> Subject: RE: [PHP] test
>
> na! didn't work :) 
>
> -Original Message-
> From: Roger Lewis [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 18, 2002 4:59 PM
> To: Php-General
> Subject: [PHP] test
>
> This is a test.


-- 
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] *OK, more eval for today

2002-12-18 Thread Martin Towell
argh! eval()
try this instead: $temp = ${"php_q3_$i"};
to get it directly from $HTTP_POST_VARS: $temp =
$HTTP_POST_VARS["php_q3_$i"];
simple

HTH
Martin

-Original Message-
From: Alexey Lysenkov [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 6:08 AM
To: [EMAIL PROTECTED]
Subject: [PHP] *OK, more eval for today


I know, it's eval = evil, but I don't see any other way I can check for 120
variables submitted via post, without making a temp variable, assigning a
value of the posted Var and checking for it (and deciding on the further run
of the script). Anyways, I took a classical eval thing and am doing fine
with it. It looks like this:

$temp = "\$php_q3_".$i; // $i is a loop index
eval ("\$temp = \"$temp\";");

works alright. Now, how do I eval directly from the $HTTP_POST_VARS?

I am trying to do this:

$tempVar1 = '\$HTTP_POST_VARS[\"q4_'.$i.'"]';
  eval("\$tempVar1=\"$tempVar1\";");

and am obviously failing. If you know any other way to validate 120-150
variables in a loop and then rewrite the values into the fields (checkboxes,
radios and selects) - should an error had been made - let me know.

Best Regards,
Alex

p.s. you do help! :)

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




RE: [PHP] getting green screen

2003-01-20 Thread Martin Towell
Hi Martin

Post some code snippets and the resultant output for us to look at

Martin (To confuse things )

> -Original Message-
> From: martin [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 21, 2003 1:43 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] getting green screen
> 
> 
> Hi,
> I'm somtimes getting a green screen after a PHP-app (green 
> background and
> backslashes in front of "'"-signes. When reloading this 
> outputpage, the
> normal lay-out without backslashes is visible.
> 
> Why does this happen? Can I prevent it?
> 
> Martin
> 
> 
> 
> -- 
> 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] ? in URLS.

2003-01-23 Thread Martin Towell
if it's just the string after the ? then use $QUERY_STRING
can't remember which $_* variable it's under...
HTH

> -Original Message-
> From: Simon Angell [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 24, 2003 4:50 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] ? in URLS.
> 
> 
> Ok, ill explain my self further. the URL in the script is
> http://www.weatherzone.com.au/yourHomePage.jsp?ref=f2eeb571ed
> 
> The script uses the URL to see the page and store it locally, 
> then another
> script grabs selected data from that page. the stuff after the ? is
> essential for the data i want to be displayed, with out that part, the
> script only sees the base page without the data i need, so 
> hence it doesn't
> grab it. so how do i use the
> $_GET['var1']
> $_GET['var2']
> $_GET['var3']
> 
> or urlencode() in the script
> this is the script.
>  //Writing of local file
> 
>  $rContents = implode( "\r\n", file(
> 'http://www.weatherzone.com.au/yourHomePage.jsp?ref=f2eeb571ed' ) );
> 
> if( ($fp = fopen( 'wztest.txt', 'wb+' )) !== false )
> {
> fputs( $fp, $rContents );
> fclose( $fp );
> }
> ?>
> 
> 
> --
> 
> Cheers
> -
> Simon Angell
> Canberra, ACT
> www.canberra-wx.com
> -
> Proud member of the
> Australian Severe Weather Association.
> www.severeweather.asn.au
> --
> "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > use urlencode()
> >
> > Simon Angell wrote:
> >
> > >Hi All.
> > >I am currently playing with sripts, and have come across a 
> problem, that
> i
> > >can't slove. (i am a novice - lol).
> > >The script requires a URL to grab data from. The URL has a 
> ? in it, and
> > >testing the script it grabs the base data of the URL, but not the
> essential
> > >data i need, which is only brought up with what comes 
> after the ? in the
> > >URL. now i figure it has something to do with the ? in the 
> URL but i
> can't
> > >seem to fix it myself.
> > >
> > >Thanks
> > >
> > >--
> > >
> > >Cheers
> > >-
> > >Simon Angell
> > >Canberra, ACT
> > >www.canberra-wx.com
> > >-
> > >Proud member of the
> > >Australian Severe Weather Association.
> > >www.severeweather.asn.au
> > >--
> > >
> > >
> > >
> > >
> > >
> >
> 
> 
> 
> -- 
> 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] problems with ==?

2003-02-06 Thread Martin Towell
check for leading/trailing spaces

if (trim($view) == "vendor")

HTH
Martin

-Original Message-
From: Peter Gumbrell [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 07, 2003 3:07 PM
To: Php-General
Subject: [PHP] problems with ==?


In the following code

$view = $HTTP_GET_VARS[view];
print $view;
if ($view == "vendor")
{ code here
}

print $view produces 'vendor'

but the if statement in the next section isn't being triggered. Can anyone
see what is wrong here? I have tried double quotes, single quotes and no
quotes around 'vendor' but none of them work.

Thanks

Peter Gumbrell



-- 
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] Switch Statement || Case with multiple values?

2003-03-02 Thread Martin Towell
I've been using this:

if (in_array($value, array("foo", "bar", "blah")))
{
  // do something
}

but if you want to use a switch/case, I don't know any easier way.

HTH
Martin

> -Original Message-
> From: CF High [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 03, 2003 1:41 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Switch Statement || Case with multiple values?
> 
> 
> Hey all.
> 
> In Cold Fusion I was able to do the following:
> 
> 
> 
> 
> Do Stuff
> 
> 
> 
> 
> Note the comma delimited set of values for the case.  Is 
> there a way to do
> this in php?( i.e. if any of the comma delimited case values match the
> switch expression, proceed with the specified case instructions)
> 
> It's kind of cumbersome breaking out 5 cases when in CF I can 
> combine them
> into one
> 
> Let me know.
> 
> --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



RE: [PHP] heredoc problem

2003-03-02 Thread Martin Towell
when I copy/pasted directly from your email and tried to execute it, I can
an error on line 5 too

I noticed that there's a space at the end of line 5, I deleted it and it
worked fine.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 03, 2003 9:02 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] heredoc problem
> 
> 
> Can someone tell me what is wrong with the following code:
> 
> 
> Testing
> 
>  $str = << Example of string 
> spanning multiple lines 
> using heredoc syntax.
> EOD;
> ?> 
> 
> 
> 
> This is code straight out of the PHP manual. I get the error:
> Parse error: parse error, unexpected T_SL in testhere.php on line 5
> 
> I looked up T_SL and it is a token representing << so that 
> means it just
> doesn't get the <<<. Why not? I've tried all the combinations 
> of spaces and
> no space in that line that I can think of.
> 
> So, what's wrong. Undoubtedly something obvious to anyone except me.
> 
> Janet
> 
> -- 
> 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] fread problem

2003-03-02 Thread Martin Towell
you'll have to exec() the code

 $filename = "test.php";
 $handle = fopen ($filename, "r");
 $contents = fread ($handle, filesize ($filename));
 fclose ($handle);
 exec($contents);

see if that works
Martin

> -Original Message-
> From: Paul Cohen [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 03, 2003 3:46 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] fread problem
> 
> 
> Hello all,
> 
> I am trying to read a php file to a varible and then print 
> that variable.
> Unfortunately, my php file is not being parsed by the fread 
> function and I
> can't figure out why.
> 
> Here is the code in my file and was taken directly from the manual:
> 
> $filename = "test.php";
> $handle = fopen ($filename, "r");
> $contents = fread ($handle, filesize ($filename));
> fclose ($handle);
> echo $contents;
> 
> Here is test.php >>>
> 
>  echo "Hello World";
> ?>
> 
> <<< END test.php
> 
> 
> When I run this, I get a blank page with my php code as my 
> HTML source code.
> Not good.
> 
> Finally, if you respond to this, please copy me directly as I get the
> mailing list as a digest.
> 
> Thx,
> 
> Paul
> 
> 
> 
> 
> -- 
> 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-06 Thread Martin Towell
code snippets would be helpful

-Original Message-
From: Liam Gibbs [mailto:[EMAIL PROTECTED]
Sent: Friday, March 07, 2003 5:07 PM
To: php list
Subject: Re: [PHP] Dollar signs in values


> Escape them with a backslash:
>
> $text = "The amount is \$400.-";

All that does is print \$ in my HTML.

What's going on is that it will put, say, RR$T into a file when that's typed
into a textbox or any typable form control. That's properly saved in the
file.

So the file will contain RR$T.

When it's output, it could be RR, or RR$T, depending on some unpredictable
factors (haven't figured it out).

By adding a slash, what gets saved in the file is RR\$T, but what gets
output could be RR\ or RR\$T, depending on those same factors.


-- 
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] Calculating if number is multiple of another number

2003-07-02 Thread Martin Towell
($spacer % $number == 0)

Martin

-Original Message-
From: jwulff [mailto:[EMAIL PROTECTED]
Sent: Thursday, 3 July 2003 11:04 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Calculating if number is multiple of another number


How would I calculate if a $number is a multiple of $spacer?

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



[PHP] PHP5 classes

2003-07-02 Thread Martin Towell
I've just been playing around with PHP5 beta for windows to get used to the
new way it does classes and constuctors, etc, and have found the
following...

I have a base class which has both a constructor and a destructor. I have a
second class that extends the first. I then instantiate the second class.
(see code below)

As expected, the base class's constructor is called automatically.

But when the script ends, it doesn't automatically call the base class's
destructor (as I would expect). However, if I put a destructor in the
derived class, it (second class's destructor) does get called.

Is this a bug or is there some reason for this? If it is a bug, does anyone
know off hand if this has already been reported (otherwise I'll check...)?

 START eg1 
con()\n"; }
  function __destruct() { echo "test1->de()\n"; }  // doesn't get called
}

class test2 extends test1
{
}

$x = new test2();
?>
 END eg1 

 START eg2 
class test1
{
  function __construct() { echo "test1->con()\n"; }
  function __destruct() { echo "test1->de()\n"; }
}

class test2 extends test1
{
  function __destruct() { echo "test2->de()\n"; }  // does get called
}

$x = new test2();
 END eg2 

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



RE: [PHP] Object assignment

2003-07-08 Thread Martin Towell
Since I can't see the source for append_child(), I'll assume you're using
the $key as the index??

If so, try changing it to just a numeric index, ie, 0, 1, 2, etc.

HTH
Martin

-Original Message-
From: Matt Grimm [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 9 July 2003 10:38 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Object assignment


I'm having trouble creating objects with DOMXML.  As I loop through a level
of nodes, I'm creating a new element based on the array's key name.  The XML
might look like this:


  Value 1
  Value 2


So I'd be doing this with DOMXML in a loop:

$thisChild = $doc->create_element($key);
$thisChild = $ancestor->append_child($thisChild);

Where $key is 'record' in this example, and $ancestor is 'rootElement',
which is carried along in the function.

The problem that when I reach the second element by the same name, and in
the same node level, I'm overwriting the $thisChild object that I just
created.  How can I dynamically name these objects so that I can have an
indeterminate number of elements by the same name, in the same level?

Source:
http://www.healthtvchannel.org/test/php2xml.phps

Thanks,
--
Matt Grimm
Web Developer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Parkway
Anchorage, AK 99508
907.770.6200 ext. 686
907.336.6205 (fax)
E-mail: [EMAIL PROTECTED]
Web: www.healthtvchannel.org



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__ Information from NOD32 1.452 (20030703) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



RE: [PHP] how to force variables declaration??

2003-07-08 Thread Martin Towell
change your error reporting level to E_ALL
You'll then get a warning|notice (can't remember which)

-Original Message-
From: mack paul [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 9 July 2003 11:10 AM
To: [EMAIL PROTECTED]
Subject: [PHP] how to force variables declaration??


hi to all.

i would like to know how to force to php to declare everything variable,
example

var $var;
$var = bla,bla..
var $var2 = array();
$var2 = bla,bla..

and issue error when a variable is instanced without declare, some idea???:



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__ Information from NOD32 1.452 (20030703) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



RE: [PHP] do i need to output headers on parsed CSS files?

2003-07-23 Thread Martin Towell
If I remember correctly, it'd be

header("Content-Type: text/css");

HTH
Martin

-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]
Sent: Thursday, 24 July 2003 12:42 PM
To: php
Subject: [PHP] do i need to output headers on parsed CSS files?


Hi all,

I'm forcing my style sheets (.css) though the PHP parser, so that they 
can take advantage of some color variables and global config settings 
via include files, eg:

body {
background-color: #;
}

however, I've noticed that when viewing the CSS file in a browser now, 
it looks more like a HTML document int he browser (variable width 
fonts, no newlines, etc) rather than other css files (wich look like 
they have  tags aroun them (newlines visible, fixed-width font, 
etc).

So, my assumption is that pushing the .css file through PHP is putting 
the wrong header on the file (text/html) rather than text/css -- or 
perhaps something else -- my header knowledge is poor.

Anyway, the pages and linked CSS files *work* but do not validate any 
more, witha  warning "You can't import an HTML document".


What/how should I force the correct headers on these PHP-parsed CSS 
files?


TIA
Justin French


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__ Information from NOD32 1.466 (20030722) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



RE: [PHP] Strip Numbers

2003-07-29 Thread Martin Towell
You could use two substr()s or an ereg_replace()

$result = substr($str, 0, 2) . substr($str, 5);
or
$result = ereg_replace("([0-9][0-9])990([0-9][0-9])", "\\1\\2",
$str);

Both are not tested, but should work

Martin


-Original Message-
From: Joe Harman [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 30 July 2003 4:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Strip Numbers


Hey could someone help me out here
 
I need to strip numbers from a passed variable
 
ex. 3899007
 
all the numbers will have 990 (so that is the 4th, 5th & sixth
numbers... from the right...) I want to keep everything to the left of
the two 9s... is there an easy way to do that
 
Joe Harman

http://www.HarmanMedia.com

This `telephone' has too many shortcomings to be seriously considered as
a means of communication. The device is inherently of no value to us. -
Western Union internal memo, 1876 
 
__ Information from NOD32 1.468 (20030725) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



RE: [PHP] error: cannot redeclare ()

2003-08-07 Thread Martin Towell
thnx - I'll see if this help..

-Original Message-
From: Joe Harman [mailto:[EMAIL PROTECTED]
Sent: Thursday, 7 August 2003 4:38 PM
To: 'Martin Towell'; [EMAIL PROTECTED]
Subject: RE: [PHP] error: cannot redeclare ()


Hi Martin... I am guessing you have a nested function that is being
redeclared, your error would come from there... Just a guess anyhow...

Joe

> -Original Message-----
> From: Martin Towell [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, August 07, 2003 2:11 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] error: cannot redeclare ()
> 
> 
> I'm getting the following error:
> 
> PHP Fatal error:  Cannot redeclare () (previously declared in
> /path/to/file/functions.inc:19) in 
> /path/to/file/functions.inc on line 0
> 
> Anyone have any ideas how a no-name function could be 
> generated? Line 19 contains:
>   function idb_exec_deadlock($sql,$count=0)
> 
> There are only two lines before this that contain code (the rest are
> comments) and they are:
>   if (!$__GEN_HIR_FUNCTIONS_INCLUDE){
> $__GEN_HIR_FUNCTIONS_INCLUDE=1;
> 
> TIA
> Martin
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
__ Information from NOD32 1.468 (20030725) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



RE: [PHP] Still can't pass variable through url

2003-08-08 Thread Martin Towell
This _might_ be causing you problems...
$month=march;
strings should be quoted (unless you've define("march", "march")'ed it...)
$month='march';

Martin

-Original Message-
From: Joe Harman [mailto:[EMAIL PROTECTED]
Sent: Friday, 8 August 2003 4:55 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Still can't pass variable through url


http://www.thingamajigger.com/index.php?year=$year&month=$month\";
>yeah this is the link";
 
?>

> -Original Message-
> From: John Manko [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 08, 2003 2:47 AM
> To: Martin Towell
> Cc: 'Jack'; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] Still can't pass variable through url
> 
> 
> actually, you might want to urlencode it.
> ok, so i doubt that you would need url encoding for $year and $month, 
> but I'm sure you will playing with more of this in the future, so you 
> should properly prepare to do so.  Note: browsers will do 
> formatting for 
> you, but don't rely on it.
> 
> "page.php?year=" . urlencode($year) . "&month=" . urlencode($month)
> 
> 
> Martin Towell wrote:
> 
> >See if changing it to
> > page.php?year=$year&month=$month
> >works
> >
> >
> >The separator between the page and the query string is "?"
> >The separator between each key/value pair is just "&"
> >
> >-Original Message-
> >From: Jack [mailto:[EMAIL PROTECTED]
> >Sent: Friday, 8 August 2003 4:30 PM
> >To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> >Subject: [PHP] Still can't pass variable through url
> >
> >
> >Dear all
> >I had set the "register_global=on" and "magic_quotes_runtime=off" 
> >already, but when i click my hyperlink 
> >"page.php?year=$year&?month=$month", it doesn't pass the 
> variable for 
> >?year and ?month to the destination page "page.php" I'm 
> using php 5.0 
> >above , if the same case apply to php4.04, then there is no 
> problem at 
> >all! Can anyone please give me more help on this?
> >
> >Thx alot
> >Jack
> >

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



RE: [PHP] postmaster@hanmir.com

2003-08-08 Thread Martin Towell
Yep - I did with me previous email
And I guess I'll get one with this email too :/

-Original Message-
From: Joe Harman [mailto:[EMAIL PROTECTED]
Sent: Thursday, 7 August 2003 4:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP] [EMAIL PROTECTED]


Hey is every one getting a returned message from
[EMAIL PROTECTED]
 
Joe Harman


 
__ Information from NOD32 1.468 (20030725) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



RE: [PHP] Still can't pass variable through url

2003-08-10 Thread Martin Towell
See if changing it to
page.php?year=$year&month=$month
works


The separator between the page and the query string is "?"
The separator between each key/value pair is just "&"

-Original Message-
From: Jack [mailto:[EMAIL PROTECTED]
Sent: Friday, 8 August 2003 4:30 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] Still can't pass variable through url


Dear all
I had set the "register_global=on" and "magic_quotes_runtime=off" already,
but when i click my hyperlink "page.php?year=$year&?month=$month", it
doesn't pass the variable for
?year and ?month to the destination page "page.php"
I'm using php 5.0 above , if the same case apply to php4.04, then there is
no problem at all!
Can anyone please give me more help on this?

Thx alot
Jack



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__ Information from NOD32 1.468 (20030725) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



RE: [PHP] Calling to a page without having to load it

2003-08-14 Thread Martin Towell
You could use a "hidden" image
Or use an external javascript file that's really the php file

HTH
Martin

-Original Message-
From: Creative Solutions New Media [mailto:[EMAIL PROTECTED]
Sent: Friday, 8 August 2003 1:51 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Calling to a page without having to load it


Hello,

I have a weird problem I was hoping someone could help with.

I have a client who hosts a site on a standard server (No PHP et all)

Currently he has some Flash based content.  Within the Flash content I can
call to PHP pages in another domain to push and pull data from a mySQL DB
into the Flash App (Basically what I am doing is tracking page hits within
the flash movie).

However, now there are going to be some standard HTML pages as well (no
Flash).  I would like to be able to integrate the tracking system to record
hits on those pages as well.  Is there a way to do this externally (to
launch a PHP script on another server without actually have to load a PHP
page).

I know this is a bit of a weird thing but if anyone has a suggestion (beyond
telling the customer to spring for PHP access himself) I would appreciate it
very much.

Thanks.

Tim Winters
Manager, Creative Development
Sampling Technologies Incorporated (STI)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
W: 902 450 5500
C:  902 430 8498




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__ Information from NOD32 1.468 (20030725) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



[PHP] error: cannot redeclare ()

2003-08-14 Thread Martin Towell
I'm getting the following error:

PHP Fatal error:  Cannot redeclare () (previously declared in
/path/to/file/functions.inc:19) in /path/to/file/functions.inc on line 0

Anyone have any ideas how a no-name function could be generated?
Line 19 contains:
function idb_exec_deadlock($sql,$count=0)

There are only two lines before this that contain code (the rest are
comments) and they are:
if (!$__GEN_HIR_FUNCTIONS_INCLUDE){
$__GEN_HIR_FUNCTIONS_INCLUDE=1;

TIA
Martin

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



RE: [PHP] If you ever had a Vic20

2003-08-15 Thread Martin Towell
What about (just a slight change...)?

$found = 0;
while ($mydata = mysql_fetch_object($news))
{
if ($mydata->StudentId == $StudentId)
{$found = 1;  break;}
}

if ($found==1){do this}else{do that}

at least this way you don't need to go through all the other records if it's
found near the start...



[OT] - Vic-20 - hmmm, them were the days...

Martin


-Original Message-
From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]
Sent: Friday, 15 August 2003 4:52 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] If you ever had a Vic20


Ok ... so I can do it this way (below), but there must be a more intelligent
way? This is like something I did with my Vic20, 19 years ago. (If you ever
had a Vic20 ... :) you might sympathise)

while ($mydata = mysql_fetch_object($news))
{
if ($mydata->StudentId = $StudentId)
{$found =1}else{$found=0}
}

if ($found==1){do this}else{do that}



> $myconnection = mysql_connect($server,$user,$pass);
> mysql_select_db($db,$myconnection);
>
> $news = mysql_query("select StudentId FROM $table");
>
> while ($mydata = mysql_fetch_object($news))
> {
> }
>
> if exists
> {do this}else{do that}



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



RE: [PHP] If you ever had a Vic20

2003-08-18 Thread Martin Towell
> [snip]
>   $found = 0;
>   while ($mydata = mysql_fetch_object($news))
>   {
>   if ($mydata->StudentId == $StudentId)
>   {$found = 1;  break;}
>   }
> 
>   if ($found==1){do this}else{do that}
> [/snip]
> 
> Why two if's? Isn't if the student is found in the first if, don't you
> want to do stuff then? Just curious...


It's so the "not found" condition can be checked and handled.. You'd still
need a second if to handle that..

eg
$found = 0;
while ($mydata = mysql_fetch_object($news))
{
if ($mydata->StudentId == $StudentId)
{do this; $found = 1;  break;}
}
 
if (!$found){do that}


Martin

-- 
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-18 Thread Martin Towell
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
__ Information from NOD32 1.481 (20030812) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




-- 
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-18 Thread Martin Towell
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



RE: [PHP] unexpected date results

2003-08-20 Thread Martin Towell
The reason for the difference is due to the timezone bit (or whatever it's
called..)

Note the +1000 in this line
time = Thu, 21 Aug 2003 15:28:36 +1000 
and the + in this line
time = Thu, 21 Aug 2003 05:28:42 +
so both are actually the same times (bar a few seconds..)

But for the reason why one is showing GMT and the other Oz time, I don't
know...

HTH though
Martin


-Original Message-
From: Cody Phanekham [mailto:[EMAIL PROTECTED]
Sent: Thursday, 21 August 2003 3:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] unexpected date results


Ive got a pretty simple script that runs at 5 past midnight. It grabs the
local date/time and processes data based on the date/time. The problem is
the date/time returned by the date() function is incorrect.

here is a sample script (not actual script running on server):
test.php
timestamp = $t";
echo "\ntime = " . date("r", $t);
?>

if i run test.php via the web it produces the following output, which is
correct:
timestamp = 1061443716 
time = Thu, 21 Aug 2003 15:28:36 +1000 

if i run test.php via the command line it produces the following output,
which is off by 10 hours:
timestamp = 1061443722
time = Thu, 21 Aug 2003 05:28:42 +

has this happened to anyone before? what could cause the huge difference in
time?

Im running PHP Version 4.3.2 on NetBSD 1.6

--
Regards

Cody Phanekham

Email: [EMAIL PROTECTED]
Ext: 2183
Phone: 02 9353 2183





*
This e-mail, including any attachments to it, may contain confidential
and/or personal information.
If you have received this e-mail in error, you must not copy, distribute, or
disclose it, use or take any action 
based on the information contained within it.

Please notify the sender immediately by return e-mail of the error and then
delete the original e-mail.

The information contained within this e-mail may be solely the opinion of
the sender and may not necessarily 
reflect the position, beliefs or opinions of Salmat on any issue.

This email has been swept for the presence of computer viruses known to
Salmat's anti-virus systems.

For more information, visit our website at  www.salmat.com.au.

*


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__ Information from NOD32 1.490 (20030820) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



[PHP] mb_send_mail displays boundary marker

2003-08-26 Thread Martin Towell
I've written an email class that works fine when I use mail()

But now I have added support for mb_send_mail() and the boundary marker is
being displayed in the body of the email. Putting it back to mail() works
fine...

I'm doing all the header info myself (ie, mb_send_mail('', '', $body,
$headers))

This is the contents of $headers
- START -
X-Mailer: SEE-IT's PHP email_class (c)2001
Mime-Version: 1.0
Subject: Saturday Lotto - 2003-08-02 - $19m
Sensitivity: normal
Importance: normal
X-Message-Flag: 
Reply-By: 
Expiry-Date: 
To: Martin Towell <[EMAIL PROTECTED]>
From: Martin Towell <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Error-To: [EMAIL PROTECTED]
Cc: 
Bcc: 
Content-Type: multipart/mixed; boundary="f269fe8a8c57c93d707399ffb68beeb6"
- END -

And this is the $body
- START -
--f269fe8a8c57c93d707399ffb68beeb6
Content-Type: text/html



Test HTML text



--f269fe8a8c57c93d707399ffb68beeb6--
- END -

I thought I may have to use mb_encode_mimeheader() but that didn't seem to
work either :(

Anyone have any suggestions on where I may/am going wrong?

TIA
Martin

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



[PHP] Getting linux server's country

2003-03-18 Thread Martin Towell
I've been looking for an answer to this question for ages, but have failed.
Hopefully one of you guys can help.

I'm looking for a way of finding out what the linux server's country is set
to.

I notice there's setlocale(), but I want something more like getlocale(),
which there doesn't seen to be one.

I'm using PHP 4.0.6

TIA
Martin

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



RE: [PHP] Getting linux server's country

2003-03-19 Thread Martin Towell
So noone has any ideas at all ? Surely not ?
If my question's too vague, please let me know and I'll try to expand on
it...

-Original Message-----
From: Martin Towell [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 19, 2003 4:40 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Getting linux server's country


I've been looking for an answer to this question for ages, but have failed.
Hopefully one of you guys can help.

I'm looking for a way of finding out what the linux server's country is set
to.

I notice there's setlocale(), but I want something more like getlocale(),
which there doesn't seen to be one.

I'm using PHP 4.0.6

TIA
Martin

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



RE: [PHP] Zero Fill -> Number Format

2003-03-19 Thread Martin Towell
sprintf/printf("%7d", $num)

-Original Message-
From: Harry.de [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 10:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Zero Fill -> Number Format


How can I put out a Zero Fill for numbers
The result should be

$something=26;
echo $something;

e.g.
026

I didn't found a solution with number format. Is there any other way?



-- 
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] strip single quotes

2003-03-19 Thread Martin Towell
try this
$address2 = str_replace("'", "''", $address)

-Original Message-
From: Daniel McCullough [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 1:48 PM
To: [EMAIL PROTECTED]
Subject: [PHP] strip single quotes


I'm trying to query the database using a string pulled out of the database 
and compare and get the id.  I can do it to a certain point and what kills 
my query is single quotes.  I CANNOT figure out how to escape it.

I DID THIS:
$address2 = str_replace("'", "", $address);

that worked on some, but not all.
$address = stripslashes($store['address']);
$address = str_replace("'", "", $address);
$address = htmlspecialchars($address);
$address = addslashes($address);

anyone

Some errors I have gotten back
"You have an error in your SQL syntax near 's Linen & Home'' at line 1"
and
"You have an error in your SQL syntax near 's 800 number.'' at line 1"




_
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus


-- 
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] Zero Fill -> Number Format

2003-03-20 Thread Martin Towell
oops, sorry - try this instead

sprintf/printf("%07d", $num)

-Original Message-
From: Boaz Yahav [mailto:[EMAIL PROTECTED]
Sent: Friday, March 21, 2003 8:23 AM
To: Martin Towell; Harry.de; [EMAIL PROTECTED]
Subject: RE: [PHP] Zero Fill -> Number Format


wouldn't this just print empty spaces before the number instead of the
needed Zeros?

-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 20, 2003 1:11 AM
To: 'Harry.de'; [EMAIL PROTECTED]
Subject: RE: [PHP] Zero Fill -> Number Format


sprintf/printf("%7d", $num)

-Original Message-
From: Harry.de [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 10:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Zero Fill -> Number Format


How can I put out a Zero Fill for numbers
The result should be

$something=26;
echo $something;

e.g.
026

I didn't found a solution with number format. Is there any other way?



-- 
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] multiple foreach

2003-03-20 Thread Martin Towell
try this...

for ($i = 0; $i < count($charge); $i++)
{
  $c = $charge[$i];
  $s = $size[$i];
  $sql = "UPDATE products_to_sizes SET surcharge = '$c'
WHERE product_id = '$products_id' AND size_id = '$s'";
mysql_query($sql) or die ("Couldn't update rows".MYSQL_ERROR());
  print $sql.'';
}

-Original Message-
From: Richard Whitney [mailto:[EMAIL PROTECTED]
Sent: Friday, March 21, 2003 1:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP] multiple foreach


Maybe someone can see what I'm trying to do with this:

foreach($charge as $c){

foreach($size_id as $s){$sql = "UPDATE products_to_sizes SET surcharge =
'$c'
WHERE product_id = '$products_id' AND size_id = '$s'";
mysql_query($sql) or die ("Couldn't update rows".MYSQL_ERROR());
print $sql.'';}
}

I get this:

UPDATE products_to_sizes SET surcharge = '1.50' WHERE product_id = '28' AND
size_id = '6'
UPDATE products_to_sizes SET surcharge = '1.50' WHERE product_id = '28' AND
size_id = '7'
UPDATE products_to_sizes SET surcharge = '3.00' WHERE product_id = '28' AND
size_id = '6'
UPDATE products_to_sizes SET surcharge = '3.00' WHERE product_id = '28' AND
size_id = '7'

I need to get rid of the two middle statements

Help!! :-)

-- 
Richard Whitney   *
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED]   *
http://xend.net*
602-971-2791
  * *   *
*  *  *__**
 _/  \___  *
 *  /   *\**
  */ * *  \
**/\_ |\
 /   \_  /  \
/  \/\
   /  \ 
  /\
 /  \


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

2003-03-20 Thread Martin Towell
is this what you're after ?

flush();
wait(5);  // I think wait() is in seconds
echo "blah";

-Original Message-
From: Sebastian [mailto:[EMAIL PROTECTED]
Sent: Friday, March 21, 2003 2:54 PM
To: php list
Subject: [PHP] echo


hello all,

is it possible to delay an echo say by 5 seconds after the page loads?

cheers,
- Sebastian

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



RE: [PHP] echo

2003-03-20 Thread Martin Towell
sorry - sleep(5);

-Original Message-
From: Sebastian [mailto:[EMAIL PROTECTED]
Sent: Friday, March 21, 2003 3:58 PM
To: Martin Towell; php list
Subject: Re: [PHP] echo


php has a wait function? I didn't know that... But i get:
Fatal error:  Call to undefined function:  wait() 

I just want to delay some text from loading too quick.
i am sure is can be done in java but i don't have any experience in it :s

cheers,
- Sebastian 

- Original Message - 
From: "Martin Towell" <[EMAIL PROTECTED]>


| is this what you're after ?
| 
| flush();
| wait(5);  // I think wait() is in seconds
| echo "blah";
| 
| -Original Message-
| From: Sebastian [mailto:[EMAIL PROTECTED]
| Sent: Friday, March 21, 2003 2:54 PM
| To: php list
| Subject: [PHP] echo
| 
| 
| hello all,
| 
| is it possible to delay an echo say by 5 seconds after the page loads?
| 
| cheers,
| - Sebastian


-- 
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 this script doesn't work?

2003-03-27 Thread Martin Towell
have you got register_globals turn on or off ?

-Original Message-
From: J. P. [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2003 5:26 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Why this script doesn't work?


I'm using Apache 2.0.44 with Win XP and PHP version 4.3.1!




-- 
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] sript doesn't work

2003-03-27 Thread Martin Towell
same question as before:
have you got register_globals turn on or off ?

-Original Message-
From: J. P. [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 10:57 AM
To: [EMAIL PROTECTED]
Subject: [PHP] sript doesn't work


Hello!
I am using Apache 2.0.44 and WinXP. I have PHP 4.3.1.
When i run the script the first page appears. But when i submit nothing
appends. What's wrong?





Nome: 
Email: 

Qual a sua linguagem de programação preferida?
PHP
C++
C
PERL

Qual o seu browser web preferido?
Netscape
Navigator
Internet
Explorer








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] date math question

2003-03-27 Thread Martin Towell
I think there's problems doing that when daylight savings starts/ends
Just something to keep in mind...

-Original Message-
From: Leo Spalteholz [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 4:32 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] date math question


On March 27, 2003 09:15 pm, Charles Kline wrote:
> I am storing my dates as unix timestamp (epoch). Am I right in
> assuming that if I need to add or subtract days from this it is
> done in seconds?

yes


-- 
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] delete lines from text file

2003-06-05 Thread Martin Towell
I think you'll have to read the file manually (file() would prob be the best
bet) and manually find/delete the line and then rewrite the file.

Martin

-Original Message-
From: Matt Palermo [mailto:[EMAIL PROTECTED]
Sent: Friday, June 06, 2003 1:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP] delete lines from text file


Can anyone help me figure out how to search for a string in a text file,
then delete the whole line of text that it occurs in?
 
For example:  I have a text file which contains the following.
 
//** text.txt **
Keep this line.
Also keep this line.
Delete this line.
Keep this one too.
 
 
Now I want to do a search on this text file for the word "delete" and if
it finds that word, it will delete the whole line it occurs on.  So
after this, the text file will look like this one:
 
//** text.txt **
Keep this line.
Also keep this line.
Keep this one too.
 
Can anyone help me with this?  Thanks.
 
Matt

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



RE: [PHP] using a for loop but it is not working how come

2003-06-05 Thread Martin Towell
try changing
$numbers = array($numbers);
to
$numbers = explode(",", $numbers);
HTH
Martin

-Original Message-
From: Richard Kurth [mailto:[EMAIL PROTECTED]
Sent: Friday, June 06, 2003 2:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] using a for loop but it is not working how come


I am having a problem with this script It pulls a list of numbers from
one field in the database (the numbers are in this format
(275,277,278,276) It needs to pull each number and run it through the
function dofunction and then move on to the next one in tell there are
no more to process. What am I doing wrong or is there a better way to
do this.

sql="Select Numbers from dom where name = '$name'";
$results=safe_query($sql);
$DBRow = mysql_fetch_array($results);
$numbers = $DBRow["Numbers"];
$numbers = array($numbers);
   for($i = 0; $i < count($numbers); $i++){
$number = $numbers[$i];
dofunction($number);
}
  

-- 
Best regards,
 Richard  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] String containing PHP Code

2003-06-16 Thread Martin Towell
you can use exec() but be sure that the code you're executing is not
malicious first

-Original Message-
From: Suhas Pharkute [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 17 June 2003 9:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP] String containing PHP Code


Hello,

I have a php script which generates a string which has php code in it. I
need to run that code.

For example:

";
?>


Is there any way that we can do it? I know I can do it by writing it to file
but then it is no more secured.

Please let me know,

Thanks
Suhas
_

Suhas S Pharkute.
P O Box 8551,
Pocatello ID 83209.
1.208.221.3896
http://myweb.cableone.net/psuhas
_
__ Information from NOD32 1.436 (20030612) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



RE: [PHP] String containing PHP Code

2003-06-16 Thread Martin Towell
oops - yeah, not exec() as in my previous email - sorry about that :/

-Original Message-
From: Steve Keller [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 17 June 2003 10:06 AM
To: Suhas Pharkute; [EMAIL PROTECTED]
Subject: Re: [PHP] String containing PHP Code


At 6/16/2003 05:45 PM, Suhas Pharkute wrote:

 > I have a php script which generates a string which has php code in 
it. I need to run that code.



http://www.php.net/eval

--
S. Keller
UI Engineer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Pkwy.
Anchorage, AK 99508
907.770.6200 ext.220
907.336.6205 (fax)
Email: [EMAIL PROTECTED]
Web: www.healthtvchannel.org


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__ Information from NOD32 1.436 (20030612) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



RE: [PHP] Can't pass query string from HTML to PHP

2003-06-19 Thread Martin Towell
check your php.ini file to see if you have register_globals set to "on" or
"off" (probably "off")

You can either turn it "on" or use $_GET["name"]

-Original Message-
From: Robby Ku [mailto:[EMAIL PROTECTED]
Sent: Friday, 20 June 2003 4:06 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Can't pass query string from HTML to PHP


Hi,
 
I've got a problem passing a query string from a HTML file to a PHP file. I
created a HTML file called "welcome.html" with the following link:
 
   Hi, I'm Andy 
 
I am trying to pass the query string Andy to a PHP file called "welcome.php"
with the following command:
 
 
 
After i load "welcome.html" in my browser, i try linking it to "welcome.php"
through the hyperlink i created. But the result i got was 
 
 "Welcome, !"
 
Where is Andy? If the code has got no problem, could it be the Web server
(IIS) or the browser (IE) im using? Or the configuration of the Web server
is not correct? Pls help!
 
Thank You
 
Beginner, 
Robbie


-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
__ Information from NOD32 1.436 (20030612) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



RE: [PHP] Month name

2003-06-24 Thread Martin Towell
date("F", mktime(0, 0, 0, $mm, $dd, $));
http://au2.php.net/manual/en/function.date.php
http://au2.php.net/manual/en/function.mktime.php


-Original Message-
From: cavagnaro [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 25 June 2003 4:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Month name


How can I get the month name from a date? If you could post with an example
i'll be gratefull

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



RE: [PHP] pdf routine - good local / bad online

2003-06-25 Thread Martin Towell
Is the pdf module being loaded on the linux machine ?
What is the error message (if any) that's displayed at the "create handle"
bit ?

Martin


-Original Message-
From: Floyd Baker [mailto:[EMAIL PROTECTED]
Sent: Thursday, 26 June 2003 10:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP] pdf routine - good local / bad online



Hi.

I have a routine creating a pdf file.  Here is the script that works
on the win98 dev box.   But when I upload it to the linux online, it
does not work.

It stops at 'create handle'.  Can someone please tell me why?

// GET COMPANY INFO
   while($row = mysql_fetch_array($mysql_result)){
   $name1 = $row['name1'];
   $name2 = $row['name2'];
   $addr1 = $row['addr1'];
   $addr2 = $row['addr2'];
   $city = $row['city'];
   $stat = $row['stat'];
   $zipc = $row['zipc'];
   $phone = $row['phone'];}

// START PDF FILE
   unlink('f:/localhost/adobe/' . $cocode . '_info.pdf');  

// create handle for new PDF document
   pdf_delete($pdf);
   $pdf = pdf_new();

// open a file 
   pdf_open_file($pdf, 'f:/localhost/adobe/' . $cocode . '_info.pdf');


I do change the 'f:/localhost' to https://xx.xx.xx,xx when uploaded.

Any thoughts will be greatly appreciated...  TIA

Floyd



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



RE: [PHP] Converting Array

2003-06-25 Thread Martin Towell
what about (untested)?

$example_data = array();
foreach ($blah_array as $key=>$value)
{
  $example_data[] = array($key, $value);
}

-Original Message-
From: John Wulff [mailto:[EMAIL PROTECTED]
Sent: Thursday, 26 June 2003 11:37 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Converting Array


I've got an array in the following format:
Array ( [Jan-1999] => 36.04,140.35,319.53,324.07 [Feb-1999] =>
1.78,71.78,320.58,141.97 )

I need it in the following format:
$example_data = array(
array("Feb-1999",1.78,71.78,320.58,141.97),
array("Jan-1999",36.04,140.35,319.53,324.07)
);

I'm such an idiot when it comes to arrays that I can't figure this out.  How
do I do it?
Thanks.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__ Information from NOD32 1.436 (20030612) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



RE: [PHP] Formating datevariables...

2002-07-22 Thread Martin Towell

As Demitrious said, use mysql to do it.

But if you want to use php, just use substr(), since all the numbers are
there, there's no point converting to unix time, just to convert it back
again... unless you're going to do some maths of it

-Original Message-
From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 9:51 AM
To: 'Ragnar'; [EMAIL PROTECTED]
Subject: RE: [PHP] Formating datevariables...


Why not let mysql do it? It has a function do to exactly that, I
think...

But php's date() is the function you're looking for...

-Original Message-
From: Ragnar [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 4:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Formating datevariables...

I have a column in a mysql table with a timestamp. The value of this
column
is for instance:

20020722185242

How do i change the format on this to "DDMM" (22072002) in php?

Thanx

-R



-- 
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] Problem with Not displaying HTML if data not found

2002-07-22 Thread Martin Towell

what about
  if (strlen($result["FLRPLAN_3"]) > 0)



-Original Message-
From: markbm [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 2:02 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Problem with Not displaying HTML if data not found


I am trying to develop a page that, in certain places, I only want it to
display the  and s if data is found for a given field.  For example,
if I only have an image for the  first floorplan of a house, I do NOT have
an image for the  second floorplan of a house, then show the first floorplan
image only.skip over that next row because the field in the db is empty.

The problem that I'm having is that the syntax that I've been using to
define "empty" in the db field does not always work.  The code reads:

if ($result[FLRPLAN_2]<>" ")  {
   printf ("");
 printf ("");
 printf (" Second Floor Plan:
")  ;

  printf ("") ;
 printf ("");
 printf ("") ;
 echo "'";
 printf (" ") ;
  printf (" ");
};



if ($result[FLRPLAN_3]<>" ")  {;
  printf ("");
printf ("
Third Floor Plan: ");
printf ("   ");
 printf ("  ");
 printf ("   ");
printf ("");
  echo "'";
printf ("  ");
 printf ("  ");
 };


I have tried:

1.  if ($result[FLRPLAN_3]<>" ")  {;
2.  if ($result[FLRPLAN_3]<>"")  {;
3.  if ($result[FLRPLAN_3]<>'')  {;
4.  if ($result[FLRPLAN_3]<>' ')  {;
5.  if ($result[FLRPLAN_3]<>NULL)  {;

and none seem to work correctly (i.e. blank field in db, but HTML row shows
up with missing image..or image is in db, but no HTML row shows up.  If
it helps, each of the "image" fields are varchar(125)basically I just
have the name of the image file, and then a pointer to the web server
directory structure

Any ideas would be greatly appreciated.  Thanks.

Mark



-- 
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] redirecting after login

2002-07-22 Thread Martin Towell

using header() should work if you don't output anything before it. If you
can restructure your code so that you can remove any output until after the
header(), then that'd be the way to go.

You said the meta refresh didn't work - did you get the syntax right? Since
I don't use it much, it's one of those tags that takes me ages to get the
syntax right (I could chuck it into a code repository somewhere, but I'm too
lazy to do that...)

Failing the above two methods, you could put a hidden form that gets
auto-submitted when the page loads

HTH
Martin

-Original Message-
From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 2:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP] redirecting after login


Hi,

A site I'm working on requires a login screen where various individuals 
will log into the site and add information for their various 
departments.  Rather than setup a different script for each department, I 
was hoping to create one script that would either accept or deny a login 
based on the username/password stored in a database, then based on the 
username/password - redirect the individuals browser to a URL.

I've got the login part working perfectly, and I can turn the URL into a 
link on the page, but I'd rather have the script just automatically forward 
the person to the page they're login gives them access to.

I've tried using header(), but since the redirection takes place about 
mid-script, it doesn't work.  I've also tried using  tag redirects, 
but those don't seem to accept the PHP/MySQL combo.

Any ideas?

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] Problem with Not displaying HTML if data not found

2002-07-22 Thread Martin Towell

it's the mysql_result()... try this...

echo "'";

mysql_result($result, 0,'FLRPLAN_2')
  ^--- you're always looking at the first row

rf: http://www.php.net/manual/en/function.mysql-result.php


-Original Message-
From: markbm [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 2:29 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Problem with Not displaying HTML if data not found


When I changed this line, it still gives me the same problem.  My db field
is a varchar(125)...could that have anything to do with it?  Basically, the
first time, without data in the field...it works fine and the  is not
displayed, but when I add data back into the field, nothing changes...its
like it does not recognize that something is back in the field.  I did a
commit on the db each time, and cleared the browser cache, etc.

Mark

"Martin Towell" <[EMAIL PROTECTED]> wrote in message
6416776FCC55D511BC4E0090274EFEF5034CFB9D@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF5034CFB9D@EXCHANGE...
> what about
>   if (strlen($result["FLRPLAN_3"]) > 0)
>
>
>
> -Original Message-
> From: markbm [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 23, 2002 2:02 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Problem with Not displaying HTML if data not found
>
>
> I am trying to develop a page that, in certain places, I only want it to
> display the  and s if data is found for a given field.  For
example,
> if I only have an image for the  first floorplan of a house, I do NOT have
> an image for the  second floorplan of a house, then show the first
floorplan
> image only.skip over that next row because the field in the db is
empty.
>
> The problem that I'm having is that the syntax that I've been using to
> define "empty" in the db field does not always work.  The code reads:
>
> if ($result[FLRPLAN_2]<>" ")  {
>printf ("");
>  printf ("");
>  printf (" Second Floor Plan:
> ")  ;
>
>   printf ("") ;
>  printf ("");
>  printf ("") ;
>  echo " src='http://www.website.com/index_files/main_files/$planid/"; .
> mysql_result($result, 0,'FLRPLAN_2')."'>'";
>  printf (" ") ;
>   printf (" ");
> };
>
>
>
> if ($result[FLRPLAN_3]<>" ")  {;
>   printf ("");
> printf ("
> Third Floor Plan: ");
> printf ("   ");
>  printf ("  ");
>  printf ("   ");
> printf ("");
>   echo " src='http://www.website.com/index_files/main_files/$planid/"; .
> mysql_result($result, 0,'FLRPLAN_3')."'>'";
> printf ("  ");
>  printf ("  ");
>  };
>
>
> I have tried:
>
> 1.  if ($result[FLRPLAN_3]<>" ")  {;
> 2.  if ($result[FLRPLAN_3]<>"")  {;
> 3.  if ($result[FLRPLAN_3]<>'')  {;
> 4.  if ($result[FLRPLAN_3]<>' ')  {;
> 5.  if ($result[FLRPLAN_3]<>NULL)  {;
>
> and none seem to work correctly (i.e. blank field in db, but HTML row
shows
> up with missing image..or image is in db, but no HTML row shows up.
If
> it helps, each of the "image" fields are varchar(125)basically I just
> have the name of the image file, and then a pointer to the web server
> directory structure
>
> Any ideas would be greatly appreciated.  Thanks.
>
> Mark
>
>
>
> --
> 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] Passing Special Characters In url

2002-07-22 Thread Martin Towell

I think the proper way of sending an ampersand is to use &

-Original Message-
From: Ricky [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 2:30 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Passing Special Characters In url


Hi,

I am having problems passing variables in a url specifically when there is
an & sign. Any suggestions?

Rick



-- 
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: Using fopen()/fread()/fscanf()

2002-07-22 Thread Martin Towell

I'm thinking that you need to remove the:
   $contents = fread($filename, 100);
line. This is probably making the file pointer point to the end of the file.

-Original Message-
From: Jason Soza [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 4:17 PM
To: David Robley; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: Using fopen()/fread()/fscanf()


I'm fairly certain that fopen() is working fine - I can echo "$contents";
and it works great, but it displays the entire page that I fetched. I just
want certain parts of the page and unfortunately, fscanf() doesn't seem to
think $contents or $filename are valid. Just more info on this, I tried
replacing fscanf($filename,...) with fscanf($contents,...) and got the same
result.

Thanks,
Jason Soza

-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 22, 2002 8:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Using fopen()/fread()/fscanf()


In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
says...
> I think I'm pretty close to getting this right (maybe!), I've been reading
> through the manual, but can't seem to work it out. I keep getting this
> error:
>
> [Mon Jul 22 19:03:24 2002] [error] PHP Warning:  Supplied argument is not
a
> valid File-Handle resource in index.php on line 66
>
> I'm trying to open a URL, read the contents, then pull out specific info
> found between specific HTML tags. This is what I have so far:
>
> 63|  64|   $filename =
> fopen("http://www.kinyradio.com/juneaunews/latest_juneau_news.html";, "r");
> 65|   $contents = fread($filename, 100);
> 66|   while($headlines = fscanf($filename, " 45\">%[a-zA-Z0-9,. ]",
> $headline)) {
> 67|   extract($headlines);
> 68|   print "
href=\"http://www.kinyradio.com/juneaunews/latest_juneau_news.html\";>$headli
> ne";
> 69|   }
> 70|   fclose($filename);
> 71| ?>
>
> Any ideas? Any other functions I could try instead of fscanf()?

That error indicates that fopen failed to open the requested file. Given
that the URL works fine in a browser, is it possible that your php is not
configured to do remote fopen? Check the setting of allow_url_fopen in
phpinfo()

It is a good idea to test the result of such calls before trying to use
the result:

fopen('Whatever') or exit('Couldn't get it, Boss!');

or

if(fopen('whatever') {
  do good things;
}else{
  bleat vigorously;
}

Cheers
--
David Robley
Temporary Kiwi!

Quod subigo farinam

--
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: Credit card checks?

2002-07-23 Thread Martin Towell

Try this:

  function do_mod_10($num)
  {
// The Luhn formula works right to left, so reverse the number.
$num = strrev($num);
$total = 0;
for ($i = 0, $j = 1; $i < strlen($num); $i++, $j=3-$j)
{
  $digit = $num[$i] * $j;
  if ($digit > 9)  $digit -= 9;
  $total += $digit;
}

return ($total % 10 == 0);
  }

-Original Message-
From: Mark McCulligh [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 10:47 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Credit card checks?


You could use an algorithms called mod10.  Both Visa, MasterCard and I think
most other credit cards use the mod10 algorithm.  A credit card must pass a
mod10 test to be a valid number(Like a Regular Expression test).  It won't
tell you if the number exist, but it will tell you if it could exist.  I
also know the mod10 is used for Canadian Social Security numbers (SIN).

Unfortunately I have never seen a PHP function for it, I only used mod10 in
a language called Uniface by Compuware.   I know there is another name for
it also, but I can't remember it right now.

It is a great test, someone just typing in numbers at random will have a
terrible time guessing a number right.  I have never seen someone do it let.
Then you can use the first character of the number to test the card type.

I will see if I can locate the algorithm and email it too you.


Mark

"Jas" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Just wondering if anyone has come across the need to develop a class to
test
> a string of numbers based on a credit card type.  If you have where would
I
> be able to get information on what string of numbers is consistent with
each
> of the different credit cards?  Any help would be appreciated!
> Jas
>
>



-- 
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] Banner Ad Serving...

2002-07-23 Thread Martin Towell

use the auto_append or auto_prepend directives in the php.ini file

-Original Message-
From: Dave at Sinewaves.net [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 1:48 PM
To: PHPlist
Subject: [PHP] Banner Ad Serving...


Is there any way of automatically adding a certain bit of code to every page
on a web server (or within a given directory)?

As in, is there any kind of Apache-specific PHP stuff that will add a banner
ad or copyright notice to pages (without editing the actual pages themselves
and without changing their file names)?  I've looked around a bit, and I
can't seem to brainstorm how it could be done.

Any help will be greatly appreciated (with good karma to boot). :)

Dave


-- 
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: create object from variable class.

2002-07-24 Thread Martin Towell

This should work
$object = new $classname;

Martin

-Original Message-
From: Michiel ten Hagen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 11:17 PM
To: 'Mathieu Dumoulin'
Cc: [EMAIL PROTECTED]
Subject: [PHP] RE: create object from variable class.


Thx for quick reply,

If I use the following:
$object = new {classname};

I get this a parse error:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE'
or `'$'' in
/home/sites/projects.virtuosys.nl/web/cm/includes/class_crm.inc.php on
line 29

>From that I conclude that with this method its not possible to create an
object from a variable class name

Michiel ten Hagen
[EMAIL PROTECTED]
06-54673863



-Oorspronkelijk bericht-
Van: Mathieu Dumoulin [mailto:[EMAIL PROTECTED]] 
Verzonden: Wednesday, July 24, 2002 3:11 PM
Aan: [EMAIL PROTECTED]
Onderwerp: Re: create object from variable class.


Simple, you made an error here
You are telling the new operator to look into a variable to get the
classname, to specify the class name as a string do this:

$object = new {$classname};

InsaneCoder

Ps: I never tried this, but I think it is actually going to work, you
got nthing to lose anyway I guess, takes two seconds to try.

"Karel De Groot" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> Is it possible to create an object from a clas which name is in a
> variable.
> 
> Example: (doesn't work)
> $object = new ${$classname};
> 
> 
> 
> 



-- 
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] Numbers with leading zero...

2002-07-24 Thread Martin Towell

you could use: printf("%02d", ++$Num);
or if you want to put it back into $Num, use the sprintf() version

-Original Message-
From: vins [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 25, 2002 10:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Numbers with leading zero...


Hi.

I've got this script that needs to take for examle 02 and increase that to
03.
but when i run the script $Num++; it changes 03 to 3;

is there not a function that adds leading zeros onto a string ?



-- 
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] Oracle 8i SQL Problem..

2002-07-28 Thread Martin Towell

You'll prob. need to use the (+) to join
like this

SELECT grp.grpdescrip, grp.grp, grp.createcust, grp.auth1, grp.auth2,
usergrp.userid, users.userdescrip
FROM grp, usergrp, users
WHERE grp.grp = usergrp.grp (+)
AND usergrp.userid=users.userid (+)
ORDER BY grp.grp

-Original Message-
From: Nick Oostveen [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 29, 2002 1:47 PM
To: Frank S. Kicenko; [EMAIL PROTECTED]
Subject: Re: [PHP] Oracle 8i SQL Problem..


I could be wrong on this but I believe that Oracle 8i uses a proprietary 
join syntax.  This support has been added in the latest version of Oracle, 
but with 8i I believe you're out of luck using the left join keywords.

Check out 
http://certcities.com/certs/oracle/columns/story.asp?EditorialsID=106 for 
more info on this.

At 10:26 AM 7/28/2002 -0500, Frank S. Kicenko wrote:
>Hi,
>This really isn't a PHP issue..sorry.
>
>I'm having a nightmare with Oracle 8i (pos!). I'm writing common SQL
>which works for MSSQL 2K and seems correct for Oracle... but keeps
>giving me a Error.. ORA-00933 SQL command not properly ended on the
>following query...
>
>SELECT grp.grpdescrip, grp.grp, grp.createcust, grp.auth1, grp.auth2,
>usergrp.userid, users.userdescrip
> FROM grp
> LEFT JOIN usergrp
> ON grp.grp=usergrp.grp
> LEFT JOIN users
> ON usergrp.userid=users.userid
> ORDER BY grp.grp
>
>The error keeps pointing at the first "LEFT JOIN". Anybody know why?
>
>--
>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: Table formatting

2002-07-28 Thread Martin Towell

try changing these two lines

$num_rows = mysql_num_rows($result);
$num_cols = 2;

to this

$num_cols = 2;
$num_rows = mysql_num_rows($result) / $num_cols;

this isn't the full solution, but will help you on your way...

HTH
Martin

-Original Message-
From: César Aracena [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 29, 2002 2:03 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Re: Table formatting


I know no one in this list like to think we newbie's want the job done
for us, so I'm trying to figure out the below question myself, but trust
me when I say it's making me nuts... this is my best shot so far:

$query = "SELECT * FROM saav_arts ORDER BY artid";
$result = mysql_query($query) or die(mysql_error());
$num_rows = mysql_num_rows($result);
$num_cols = 2;

for ($x = 0; $x < $num_rows; $x++)
{
echo "";

for ($i = 0; $i < $num_cols; $i++)
{

$row = mysql_fetch_array($result);
echo "";
echo "artdir."/".$row[artsmall]."\"
ALT=\"".$row[artname]."\" BORDER=\"0\">";
echo "";
}

echo "";
}

The thing is that it shows up two columns as I want, but not the 4
images that I have in DB... it shows 2 rows of 2 images each and antoher
2 rows of 2 *NOT DIPLAYED* images which I don't have... like it was
looping again with nothing to fetch from the DB... What is this?

Jason: as I wrote this, your tip came over and as you can see I did
figure it out (almost melted my brain though)... now, do you know what
is going on?

Thanx, C.

> -Original Message-
> From: César Aracena [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 29, 2002 12:27 AM
> To: 'Chris Earle'; [EMAIL PROTECTED]
> Subject: RE: [PHP] Re: Table formatting
> 
> I like this method a lot. Now, considering I do like FOR looping as a
> fact, how can I make a loop inside another loop. I mean, if I tell the
> first loop that $i=0 and then do the comparison and then add 1 to $i,
in
> the inner or second loop should I state that $i=$i or what? Also make
it
> $i=0???
> 
> Thanks, C.
> 
> > -Original Message-
> > From: Chris Earle [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, July 27, 2002 1:54 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Re: Table formatting
> >
> > You can do what he said or just put a separate loop inside the
> original
> > loop.
> >
> > Depending on how you get the info, you can use either way (his would
> > create
> > less overhead if you are just using the same  info every row,
> > otherwise
> > they're really the same because his way you'll have to create an
array
> to
> > access later for multiple rows, or just do my way and have the loop
> access
> > the NEXT *3* (or whatever) items ...).
> >
> > i.e.,
> > for (LOOP FOR )
> > {
> > for (LOOP FOR ) {}
> > }
> >
> > "César aracena" <[EMAIL PROTECTED]> wrote in message
> > 001a01c234f0$a5e8ad80$28ed0dd1@gateway">news:001a01c234f0$a5e8ad80$28ed0dd1@gateway...
> > Hi all.
> >
> > Last nite I've came across a problem I wasn't able to figure out by
my
> > self. It's not difficult to make a loop that will make new *TABLE
> ROWS*
> > () to show several DB objects in a nice way. what I need to do,
is
> > to display 2 or maybe even 3 of this objects stored in a DB per
table
> > row, separated in different *TABLE COLUMS* (). how can I achieve
> > this? What I usually do is:
> >
> > --
> > // DB QUERY
> > $query = "SELECT * FROM table_name";
> > $result = mysql_query($query) or die(mysql_error());
> > $num_rows = mysql_num_rows($result);
> >
> > // NOW THE LOOP
> > for ($i=0; $i<$num_rows; $i++)
> > {
> >  $row = mysql_fetch_array($result);
> >  echo "";
> >  echo "";
> >  echo $row[whatever];
> >  echo "";
> >  echo "";
> > }
> > --
> >
> > but how can I get 2 or 3 columns displaying different db objects? A
> loop
> > inside a loop?
> >
> > Thanks in advance,
> >
> >   Cesar Aracena
> > CE / MCSE+I
> > Neuquen, Argentina
> > +54.299.6356688
> > +54.299.4466621
> >
> >
> >
> >
> >
> > --
> > 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] Not a Valid File-Handle Resource

2002-07-29 Thread Martin Towell

1. Take out the @ before fopen(), this may shed some light on your problem
2. What does "/home/blurredv/data/".$username."Contact.txt" expand out to
actually be?
3. Does the script have write access to the directory/file?

-Original Message-
From: Chris Carlson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 30, 2002 1:09 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Not a Valid File-Handle Resource


I am trying to create a php program and am getting an error in this area
of my script:

  $dataFile =
@fopen("/home/blurredv/data/".$username."Contact.txt","w");
  fputs($dataFile, $line);
  fclose ($dataFile);

These are the errors:

Warning: Supplied argument is not a valid File-Handle resource in
/home/blurredv/public_html/redcarbon/update.php on line 34
Warning: Supplied argument is not a valid File-Handle resource in
/home/blurredv/public_html/redcarbon/update.php on line 35

Note:  My script work perfectly with different path names under Windows
NT.  Do I have to do something special for Unix.

Thanks in advance,

Chris Carlson
totaldeveloper.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] What is REGEX ?

2002-07-29 Thread Martin Towell

REGEX is short for "Regular Expressions"
It gives you a "smarter" way to manupulate strings.

The PHP manual has some good docs on reg.ex. - see section LXXXIV and LXXXVI

HTH
Martin

-Original Message-
From: Lord Loh. [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 30, 2002 5:07 PM
To: [EMAIL PROTECTED]
Subject: [PHP] What is REGEX ?


Hello! I am new to REGEX.
I tried to read several posts on REGEX. However none were descriptive.

What is Regex ?
Is it a part of the php? or an additional module?
What can it be used for ?

Please let me know
Thank you.

Lord Loh.



-- 
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: One more question

2002-07-29 Thread Martin Towell

You'll have to check that the results you get back from the database
actually contains something before you echo anything out.
 
Another way would be something like this
 
$numcols = 2;
$counter = 0;
while (($results = mysql_results(...)) !== false)   // haven't used mysql,
so you'll have to fix this line up :)
{
  if ($counter % $numcols == 0)  echo "";
  // echo image stuff here
  if ($counter % $numcols == $numcols-1)  echo "";
}
if ($counter % $numcols != $numcols-1)  echo "";
 
(if I remember your original post correctly)
 
Martin

-Original Message-
From: César Aracena [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 30, 2002 3:27 PM
To: [EMAIL PROTECTED]; PHP General List
Subject: One more question



Martin.

 

Hoping you are still there, I would like to ask you one more question about
the last mail you answered me about Table Formatting (maybe you missed my
last question ;). After I used what you told me for nesting FOR loops, I end
up getting one blank image (NOT DISPLAYED) whenever I have an odd quantity
of objects in my DB... Do I have to store objects in the DB by 2 from now
on?

 

I'm working it for http://www.saavedraart.com 
under the gallery section (only module I have so far). It would be nice if
you check it out and tell me your opinion. Same goes for everybody else ;)

 

Thanks a lot,

 

 

  Cesar Aracena

CE / MCSE+I

Neuquen, Argentina

+54.299.6356688

+54.299.4466621

 




RE: [PHP] PHP4 and MS Excel?

2002-07-30 Thread Martin Towell

I don't think you'll be able to o this directly with PHP, unless you know
the file format  of an .xls file...

You might be able to use COM somehow (??)

Might be easier for the user to save the spreadsheet out as a CSV first

Martin


-Original Message-
From: Jason Caldwell [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 31, 2002 4:06 AM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP4 and MS Excel?


I would like to give my users the ability to send (to my website) a
Microsoft Excel file, and then have my server (PHP code) extract that data
and turn it into a TAB Delimited Text file -- is this possible with PHP?

Thanks.
Jason




-- 
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] passing variable via url ( newbye question)

2002-07-30 Thread Martin Towell

Is this a direct copy from your code?
> echo $_GET['modo']." echo $_GET['color']." echo $_GET['size']." tags

see if that helps
Martin


-Original Message-
From: Saci [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 31, 2002 6:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP] passing variable via url ( newbye question)


I can pass one variable using the url on this way

http://myadress/php/mypage.php?modo=123

and to read i have the code

echo $_GET['modo']."http://myadress/php/mypage.php?modo=123&color=red&size=3

and to get

echo $_GET['modo']."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 become a good PHP coder?

2002-07-30 Thread Martin Towell

The best way to become proficient in programming (or anything, come to that)
is with _lots_ of practice.

In the case of programming, looking at other ppl's code might help you find
new ways of thinking that you'll be able to use at a later stage.

Personally, I don't bog myself down in code from the start. I think in sorta
pseudo-code, then once I have a solution, I then implement in
language-specific code.

HTH
Martin

-Original Message-
From: Wee Keat [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 31, 2002 9:39 AM
To: PHP General List
Subject: [PHP] How to become a good PHP coder?


Hi all...

I want to know how do you guys learn so much about PHP?

I have just started PHP about a month and a half ago and pior to that, I
have ABSOLUTELY NO knowledge in programming.

I bought 2 books, which is Begining PHP4 (Wrox Press) and Core PHP
programming (Prentice Hall). And that's all I can afford now... (I don't
have a lot of money.. i learn using my friend's computer). However, I am
determined to specialize in PHP. 

Can anyone point me towards a direction on how to do this properly?

Can anyone guide me through by letting me do a small part (more importantly
not critical) of your projects as an excercise so that I can start a journey
of discovery?

Thanks to all of you. And most of all thanks to all of your generosity.


Yours,
Wee Keat


"Good timber does not grow with ease; the stronger the wind, the stronger
the trees."


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




RE: [PHP] passing arrays between pages with serialize

2002-07-30 Thread Martin Towell

Can you post/send the results of doing a print_r() on the first page (the
one that's serialising) and the results of the serialize()?

-Original Message-
From: DoL [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 31, 2002 2:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] passing arrays between pages with serialize


Hi

I would like to pass three arrays, two of them are two dimensional arrays,
to another page (or to the same page just submit to itself) using hidden
field and the function serialize.

(this is a two dimensional array)
page-1
 $s_array1 = serialize($array1);



page-2
 $array1= unserialize(urldecode(stripslashes($_POST['h_array1'])));

it seems to work except there appears to be one NULL record added to the
beginning of the array.
it affects the following :-
count(array_keys($array1) ) returns actual_no_of_keys + 1
foreach () echo with one NULL record at the beginning
reset($array1) erase the array completely !!

and it doesn't help to use rawurl(en|de)code, and with | without
stripslashes!

PLEASE HELP! if you can resolve this, or has a better ways to pass arrays
between pages.

Many Thanks
/dl



-- 
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] thirds of a color wheel

2002-07-30 Thread Martin Towell

You'll need to find out how to convert from RGB to HSV

Then all you need to do is look at the hue and fiddle with that.

Sorry I can't be any more help than that, because I don't know what the
maths is to convert from one colour space to the other :(  But this should
be a start

HTH
Martin


-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 31, 2002 2:56 PM
To: php
Subject: [PHP] thirds of a color wheel


Hi,

I'm working on some scripts which generate color schemes from a base color
(RRRGGGBBB).

Working out lighter colors, darker colors and inverse (complimentary) colors
was easy, but now I'm trying to figure out the right math for a triad of
colors (3 colors with equal spacing around the color wheel), given a
starting color.

Any clues would be great :)


Justin French


-- 
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] Explain?

2002-07-31 Thread Martin Towell

Split() chops up the string (param #2) according to param #1 (in this case,
space is the delimiter). Param #3 says, don't chop more than two bits. It
then returns an array

list() assigns $arr[0] to the first variable, $arr[1] to the second, etc.

HTH
Martin

-Original Message-
From: Mantas Kriauciunas [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 31, 2002 5:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Explain?


Hey php-general,

  maybe somebody can explain me what happens in this line? because how
  mutch i read it..thought i don't get it :)

  list ($date, $laik) = split (' ', $row['time'], 2);

-- 
Best regards,
 Mantas  

Contacts:
[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] include()

2002-07-31 Thread Martin Towell

To add to this - you should place critical information (like passwords, etc)
outside the document root. That way, even if the server is mis-configured,
others wont be able to easily gain access to those files

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 01, 2002 3:38 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] include()


On Thursday 01 August 2002 15:28, Lord Loh. wrote:
> I suppose include() can be used to include files from remote systems(not
on
> WINDOWS).
>
> So, How can I protect my script from unauthorised inclusions ?
>
> A webmaster on the same server can always use a path like
> "/home/htdocs/.../config.php" and include my config .php which contains my
> database password !!
>
> Even a web master from a remote server can do the same by probably using
> http://www.xyz.net/config.php
>
> I am using windows 2000/apache/php so I really have not tried these...but
> the docs say it can be done(remote system inclusion except on win)

When you include() a remote file eg:

  http://www.xyz.net/config.php

it only includes the OUTPUT of http://www.xyz.net/config.php. Thus if all 
config.php does is assign some values to variables, ie produces no output, 
then the result of the include is nothing. 

Basically if you have a correctly configured webserver then there is no need

to worry about people remotely including your scripts (because all they see 
is the HTML produced by your script).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
"There is no statute of limitations on stupidity."
-- Randomly produced by a computer program called Markov3.
*/


-- 
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] Protect PHP coding

2002-08-01 Thread Martin Towell

One option is the Zend Encoder

Martin

-Original Message-
From: YC Nyon [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 02, 2002 2:59 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Protect PHP coding


Is there any method to encrypt PHP files.

Nyon


-- 
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] Open 10 http connections in parallel

2002-08-08 Thread Martin Towell

use C and fork()
php (AFAIK) can't do parallel programming

-Original Message-
From: NoWhErEMan [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 12:58 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Open 10 http connections in parallel 


Hello,

I had to write a script  to open 10 http connections for different links and
get the response from the host.
I do it by fopen each url one by one and save the response to a separated
file. But it slow!
I wonder if i can open 10 connnect (or more) in parallel?

Thanks in advance.
NoWhErEMaN



-- 
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] anyone can help?

2002-08-08 Thread Martin Towell

you've got a ";" after the if

IF (!$accion); {

should be

IF (!$accion) {


-Original Message-
From: ::: Flavio Bastos Amiel::> [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 4:34 PM
To: [EMAIL PROTECTED]
Subject: [PHP] anyone can help?


this is not functional and i dont know why, this is stoping where if
(!$accion) is, and the wuery if you run in into the sql is
perfectREQUIRE('conexion.php');

$accion=mysql_query("SELECT * FROM empresas");

IF (!$accion); {

echo  "no se puede ver la solicitud";

}

?>



  
  $empresas";  } } ?>





-- 
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] Resetting the timeout

2002-08-18 Thread Martin Towell

set_time_limit()

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 19, 2002 12:05 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Resetting the timeout


On Monday 19 August 2002 10:06, Mike Mannakee wrote:
> Is there any way to set the timeout (max length of time the script has to
> execute) from within a script, just for its own execution?

ini_set()

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Sometimes love ain't nothing but a misunderstanding between two fools.
*/


-- 
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 string match problem

2002-08-18 Thread Martin Towell

You've got too many closing braces...

if ($temp == $temp2) {
$ierror = "Loginnamnet är redan upptaget!" . $ierror; }   <--- Here's
one
} <--- Here's
the other
} else { print "error"; } <--- And a
third one

You only need one of them...
HTH
Martin

-Original Message-
From: Pafo [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 19, 2002 3:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] php string match problem


heh,, is it just me or can anyone see whats wrong with this code...

$query = "SELECT * FROM logininfo WHERE loginname = '$LOGINNAME'";
if ($result = mysql_query($query)){
while ($row = mysql_fetch_row($result)){
$temp = $row[8];
$temp2 = $LOGINNAME;
if ($temp == $temp2) {  <--  this dosent work
$ierror = "Loginnamnet är redan upptaget!" . $ierror; }
}
} else { print "error"; }
mysql_close($db);

i have tried:
if ($row[8] == $LOGINNAME) {

dosent work either, and when i write:

while ($row = mysql_fetch_row($result)){
print $row[8] . "-" . $LOGINNAME;

it shows the exact same information

anyone got any idea?

patrick



-- 
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 string match problem

2002-08-18 Thread Martin Towell

oh, just realised, one of them needs to go below the "else" line, to end the
"while" loop

-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 19, 2002 3:37 PM
To: 'Pafo'; [EMAIL PROTECTED]
Subject: RE: [PHP] php string match problem


You've got too many closing braces...

if ($temp == $temp2) {
$ierror = "Loginnamnet är redan upptaget!" . $ierror; }   <--- Here's
one
} <--- Here's
the other
} else { print "error"; } <--- And a
third one

You only need one of them...
HTH
Martin

-Original Message-
From: Pafo [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 19, 2002 3:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] php string match problem


heh,, is it just me or can anyone see whats wrong with this code...

$query = "SELECT * FROM logininfo WHERE loginname = '$LOGINNAME'";
if ($result = mysql_query($query)){
while ($row = mysql_fetch_row($result)){
$temp = $row[8];
$temp2 = $LOGINNAME;
if ($temp == $temp2) {  <--  this dosent work
$ierror = "Loginnamnet är redan upptaget!" . $ierror; }
}
} else { print "error"; }
mysql_close($db);

i have tried:
if ($row[8] == $LOGINNAME) {

dosent work either, and when i write:

while ($row = mysql_fetch_row($result)){
print $row[8] . "-" . $LOGINNAME;

it shows the exact same information

anyone got any idea?

patrick



-- 
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] php string match problem

2002-08-18 Thread Martin Towell

oops again, please ignore my last two posts :(

-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 19, 2002 3:38 PM
To: 'Pafo'; [EMAIL PROTECTED]
Subject: RE: [PHP] php string match problem


oh, just realised, one of them needs to go below the "else" line, to end the
"while" loop

-----Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 19, 2002 3:37 PM
To: 'Pafo'; [EMAIL PROTECTED]
Subject: RE: [PHP] php string match problem


You've got too many closing braces...

if ($temp == $temp2) {
$ierror = "Loginnamnet är redan upptaget!" . $ierror; }   <--- Here's
one
} <--- Here's
the other
} else { print "error"; } <--- And a
third one

You only need one of them...
HTH
Martin

-Original Message-
From: Pafo [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 19, 2002 3:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] php string match problem


heh,, is it just me or can anyone see whats wrong with this code...

$query = "SELECT * FROM logininfo WHERE loginname = '$LOGINNAME'";
if ($result = mysql_query($query)){
while ($row = mysql_fetch_row($result)){
$temp = $row[8];
$temp2 = $LOGINNAME;
if ($temp == $temp2) {  <--  this dosent work
$ierror = "Loginnamnet är redan upptaget!" . $ierror; }
}
} else { print "error"; }
mysql_close($db);

i have tried:
if ($row[8] == $LOGINNAME) {

dosent work either, and when i write:

while ($row = mysql_fetch_row($result)){
print $row[8] . "-" . $LOGINNAME;

it shows the exact same information

anyone got any idea?

patrick



-- 
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] database value count retrieval

2002-08-19 Thread Martin Towell

try this:

->  $sqlcom="select count(codigo) as cnt from comments where codigo=$id";
$resultadocom = mysql_db_query ("database",$sqlcom);
$registocom = mysql_fetch_array($resultadocom);
->  $contador = $registocom["cnt"];
print("comentarios= $contador");

the lines marked with -> are the lines I changed

-Original Message-
From: Pag [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 20, 2002 9:38 AM
To: [EMAIL PROTECTED]
Subject: [PHP] database value count retrieval 



>SELECT COUNT(x) FROM table;
>
>Make 'x' equal to any column name in the table and add WHERE to the
>clause as needed.

 err...all very well, but how do i retrieve the value afterwards? 
Heres my code:

 $sqlcom="select count(codigo) from comments where codigo=$id";
 $resultadocom = mysql_db_query ("database",$sqlcom);
 $registocom = mysql_fetch_array($resultadocom);
 $contador = $registocom["codigo"];
 print("comentarios= $contador");

 Nothing comes out, although i dont have a clue on how to retrieve 
the result after the fetch_array. :-P


 /Pag



-- 
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] Replicate string or something similar

2002-08-19 Thread Martin Towell

str_repeat()

-Original Message-
From: Saci [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 20, 2002 1:04 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Replicate string or something similar


In ASP I use the expression myvar = string(254,"A")

to have a var filled with 254 characters 'A'

What is the similar one in 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] Sorting a multi-dimensional array

2002-08-20 Thread Martin Towell

http://www.php.net/manual/en/function.usort.php

-Original Message-
From: Ben [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 11:25 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Sorting a multi-dimensional array


I have looked at array_multisort, asort, etc. NONE of them do what I need.

My array looks like this:

$array[0][0] = First Id;
$array[0][1] = First Name;
$array[0][2] = First Rating;

$array[1][0] = Second Id;
$array[1][1] = Second Name;
$array[1][2] = Second Rating;

$array[2][0] = Third Id;
$array[2][1] = Third Name;
$array[2][2] = Third Rating;


Now, I want to sort the array (very very fast if possible cuz the array is
huge...150 such values) based on the "Rating" for each candidate, which is
the third column inside this matrix array. How should I ask PHP to do this?
Also, when I do sort by the Rating I want the ID and the name to remain the
same for each candidate, i.e., I want the indexes to be maintained.

HELP!

Thanks in advance
Ben



-- 
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] passing checkbox info

2002-08-20 Thread Martin Towell


replace "xxx" with the row number for your id field

when it gets to php, the index of $cbox will be the id from the database,
just use:
   foreach ($cbox as $id=>$dummy)
to loop through the array

HTH
Martin

-Original Message-
From: Brian & Shannon Windsor [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 2:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP] passing checkbox info


I'm trying to use checkboxes to be able to delete information from my
database.  It's just not working right.  I can't get the checkbox form to
pass a variable that makes any sense to me, and I looked into the check box
function, and it made less sense.  The value passed back from the check
boxes are always "yes", but there is nothing to tell which box passed it
back.  Maybe I don't know enough about the check boxes in general.  Any help
is appreciated.

I'm displaying the checkboxes as I display the data from the database. Can I
tie in the checkboxes to one of the fields that i could then use to delete
that entry?

Thanks,

Brian

while ($row = mysql_fetch_row($result))
{
 echo "\n";
  {
?>


";
   echo "";
  echo "";
   echo $row[1];
  echo "";
   echo $row[2];
  echo "";
   echo $row[3];
  echo "";
   echo $row[4];
  echo "";
   echo $row[5];
  echo "";
   echo $row[6];
  echo "";
   echo $row[7];
  echo "";
   echo $row[8];
  echo "\n";
  }

 echo "\n";

}

echo "";

?>



-- 
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] Average Number For Math Functions

2002-08-29 Thread Martin Towell

just sum them up and divide by the count - making sure to deal with a count
of zero

-Original Message-
From: JohnP [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 10:56 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Average Number For Math Functions


Ok I looked at all the math functions for PHP but saw no way of returning
the average of a set of numbers - I plan on using this for a rating system -
any help?

-- 
John 

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




RE: [PHP] New as of today

2002-08-29 Thread Martin Towell

if you have each filename on a new line, then use file() to grab the
contents. It returns an array, each line is an element in the array. You can
then do what you want with the array

HTH
Martin


-Original Message-
From: stu9820 [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 1:08 PM
To: [EMAIL PROTECTED]
Subject: [PHP] New as of today


Im new to PHP (came from ASP).  I'm trying to make pictures (.jpgs) come out

of a folder and display on a page.  Here is my code so far:

$zContents";
?>

I dont have database support on the server i use (school server).  I have
all 
the picture names in a text file and i want to pull out the name of pictures

from the text file and make it pull out of the picture folder.  Is there an 
easier way to do this?  Or is this the best way.  ASP is very because you
can 
loop through the file and I thought I could do it with php but it ends up in

one big link.  Thanks in advance.

Jeff
UWG Student
[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] Average Number For Math Functions

2002-08-29 Thread Martin Towell

if you have a table called "ratings" and a field called "score" in it, then
doing this will show you the sum of all the scores:

select sum(score) from ratings;

eg, if the scores were  5, 2, 5, 8, and 2 then this sql should return 22
(unless I added it wrong... :/ )

-Original Message-
From: JohnP [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 3:10 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Average Number For Math Functions


I am still very new to PHP so things are still a little foreign to me - what
exactly is the SUM finction - I tried to locate one on both the PHP and
MySQL site but found nothing!
Thanks ~ John


"Volve" <[EMAIL PROTECTED]> wrote in message
02d901c24fd5$aba46020$7800a8c0@idiom">news:02d901c24fd5$aba46020$7800a8c0@idiom...
> What database are you using?
>
> MySQL has a SUM function which automatically selects the total of a
column.
>
> -VolVE
>
> - Original Message -
> From: "JohnP" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, August 29, 2002 21:25
> Subject: Re: [PHP] Average Number For Math Functions
>
>
> > Ok so how do I sum up an entire column in my db?
> > For example if one row is : 1 , the next is 2, and the next is 1 - I
need
> to
> > have a total of 4 and the be able to divide by the num_rows
> >
> > The problem I ma having is the "inside" row addition
> >
> >
> >
> >
> > "Martin Towell" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > just sum them up and divide by the count - making sure to deal with a
> > count
> > > of zero
> > >
> > > -Original Message-
> > > From: JohnP [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, August 30, 2002 10:56 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP] Average Number For Math Functions
> > >
> > >
> > > Ok I looked at all the math functions for PHP but saw no way of
> returning
> > > the average of a set of numbers - I plan on using this for a rating
> > system -
> > > any help?
> > >
> > > --
> > > 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

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




RE: [PHP] Simple regexp

2002-08-29 Thread Martin Towell

try this

ereg("^[a-zA-Z0-9:]*$",$string)

all your's is doing is looking for any char in $string that's a-z or A-Z or
0-9 or :
instead of all chars, from start to end, being them

-Original Message-
From: Adam Alkins [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 3:20 PM
To: PHP List
Subject: [PHP] Simple regexp


Hi,

I'm trying to do a simple regexp to validate if a whole string only contains
the numbers 0 to 9, Letters a - f and A - F and the character :

Why isn't ereg("[a-zA-Z0-9:]",$string) working?

Guidance appreciated.
--
Adam Alkins
http://www.rasadam.com
--

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




RE: [PHP] How to escape " in hidden field?

2002-09-02 Thread Martin Towell

Hi Martin

You can also do this

 

HTH
Martin  :)



-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 03, 2002 11:24 AM
To: Martin Thoma
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] How to escape " in hidden field?


Hi,

Monday, September 2, 2002, 7:59:43 PM, you wrote:
MT> Hello!

MT> I have a simple hidden input-field like
MT> 

MT> Now sometimes I need to insert " like:

MT> 
MT> But this makes PHP (or the browser?) cutting of the string after "Hello
MT> ". How can I escape the "?

MT> Martin

Try this with single quotes:

 

-- 
regards,
Tom


-- 
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] IE won't post on Windows, but will on Mac

2002-09-02 Thread Martin Towell

Have you checked the $_POST (or $HTTP_POST_VAR) variable to make sure it IS
using GET?

Martin


-Original Message-
From: Jed Verity [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 03, 2002 3:19 PM
To: [EMAIL PROTECTED]
Subject: [PHP] IE won't post on Windows, but will on Mac


Hello, All,

I've given myself two black eyes and a bloody nose on this one, and I'm sure
it's a simple solution. I have a form on the php page "entry.php":





At the top of that page, I have the PHP code:



With IE 5.2 on Mac, I submit this form and I see "POST" echoed at the top of
the page.

With IE 5.5 on Windows, I submit this form and I see "GET".

How? Why? What the? I've tried playing with different encoding types and
content-types, and nothing changes the results. I also tried setting my IE
5.5 security settings to lowest and enabled everything possible. No matter
what I do, I can't POST the form. Can anyone tell me just what in tarnation
is going on here?

Many many thanks...
Jed


-- 
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] Count in PHP

2002-09-09 Thread Martin Towell

it's best done in sql using "select count(*)"
but can be done in php by looping through the result set

-Original Message-
From: Chuck "PUP" Payne [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 10, 2002 2:58 PM
To: PHP General
Subject: [PHP] Count in PHP


I am wanting to do a count in PHP. I want to be able to count the number of
records from a given database and display this count on the page. Can this
be done using PHP or is the sql thing?

Chuck Payne


-- 
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] Confusing array question ...

2002-09-10 Thread Martin Towell

Try adding curly braces around the var name, like this:

for($i=0; $imailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 9:27 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Confusing array question ...


Hi, I have 1 primary array called $item containing 20 values each of whose
value is part of the name of 20 other arrays containing various number of
values.  How can I cycle through the primary $item array using a foreach and
within that do a for on each of the 20 secondary arrays dynamically
inserting each of the 20 secondary array names based on the value of the
current primary $item array. Something like the following which obviously
does not work.



I am trying to avoid doing something like the following ...



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] What these two things mean: __FILE__ and __LINE__

2002-09-10 Thread Martin Towell

If I remember correctly
__FILE__ contains the current file name of the script
__LINE__ contails the current line number in the script
__PATH__ contains the path to the current script

HTH
Martin

-Original Message-
From: Alex Shi [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 7:56 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] What these two things mean: __FILE__ and __LINE__


I read the link, still don't get what are the exact meaning of those
two things. What the link refered is a section from PHP manul that
I have a copy on my local computer, and to me it doesn't seems
like a formal defination of them. From the messages appending
to the ariticle I saw one more thing don't understand: __PATH__.

Alex


"Kevin Stone" <[EMAIL PROTECTED]> wrote in message
008801c2590a$28d7ede0$6501a8c0@kevin">news:008801c2590a$28d7ede0$6501a8c0@kevin...
> http://www.php.net/manual/en/language.constants.php
> -Kevin
>
>
> - Original Message -
> From: "Alex Shi" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, September 10, 2002 2:31 PM
> Subject: [PHP] What these two things mean: __FILE__ and __LINE__
>
>
> > What these two things mean: __FILE__ and __LINE__ ?
> >
> > I searched manul but find nothing about them...
> >
> > Alex
> >
> > --
> > ---
> > TrafficBuilder Network:
> > http://www.bestadv.net/index.cfm?ref=7029
> >
> >
> > --
> > 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] Easy Function Question?

2002-09-10 Thread Martin Towell

function myFunction($name, $phone, $zip=""){
 echo $name.$phone.$zip
}

is the corrent format, but if you call it like this:

myFunction("name", "phone", null);

then $zip will equal null, not ""
something like this might help

function myFunction($name, $phone, $zip=""){
 if (!$zip)  $zip = "";
 echo $name.$phone.$zip
}

HTH
Martin

-Original Message-
From: Shane [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 10:14 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Easy Function Question?


I have a need to call a function, where all the variables used might not be
set. Is there a way to have a variable in a function have a default setting
if the variable passed to the function is VOID?

EXAMPLE:

$name="me";
$phone="";
//$zip is VOID

function myFunction($name, $phone, $zip){
 echo $name.$phone.$zip
}

can I write...?

function myFunction($name, $phone, $zip=""){
 echo $name.$phone.$zip
}

and then $zip will have a value of  if $zip is VOID for some reason...?

I thought it was something like this, but I keep batting ZERO and there is
no mention of this problem in the places I looked in the docs.

Can anyone throw me a bone?
Thanks gang!

-NorthBayShane

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