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




[PHP] European "daylight saving" summer-time.

2002-12-29 Thread Martin Thoma
Hello!

I just want to get the actual date and time which works fine with
date(). The problem is that php doesn't give the european
daylight-saving-time in summer, so the time shown is offset by 1 hour in
summer. It seems that my internet service provider doesn't adjust the
clock of the server to this. How can I avoid this without manually
correct it every spring/autumn?

Martin



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




[PHP] function misfunction

2002-12-30 Thread Martin S
I'm trying to redo a db lookup into a function. The function is placed in a 
class called tracking and declared thus:

function setCurrentDevGroup($devID)
{
// start original routine
$query = "SELECT dev_group FROM tracking WHERE (computer = 
   

   
   
   
   
   
   
   
   
   
   
  $devID)";
$sth = $adb->prepare($query);
if($sth)
{
$res = $sth->execute();
$resulttable = $sth->fetchrow_hash();
$lookuptable = $resulttable["dev_group"];
return($lookuptable);
}
//end original routine
}

This is called from the code as:

$tracking->setCurrentDevGroup($this->ComputerID); // $this->ComputerID is 
  // known as eg 5.

In the page which relies on the value of setCurrentDevGroup I get:



 Call to a member function on a non-object in 
/www/htdocs/dev/include/irm.inc on line 2857

Line 2857 is the one starting "$tracking->" above. Obviously I'm doing 
something wrong here. What?

Cheers,

Martin S.

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




Re: [PHP] function misfunction

2002-12-30 Thread Martin S
Jason Wong wrote:

> On Monday 30 December 2002 22:07, Michael Sims wrote:
>> On Mon, 30 Dec 2002 14:48:13 +0100, you wrote:
>> >function setCurrentDevGroup($devID)
>> >{
>> >// start original routine
>> >$query = "SELECT dev_group FROM tracking WHERE (computer
>> >=
>> >  $devID)"; $sth
>> >  =
>> > $adb->prepare($query);
>>
>> [...]
>>
>> > Call to a member function on a non-object in
>> >/www/htdocs/dev/include/irm.inc on line 2857
>>
>> Just a guess, but where did $adb inside your function come from?  It
>> doesn't appear that you've instantiated it.
> 
> Specifically, if it's instantiated elsewhere in your code and it's in the
> global scope then you need to declare it as global within your function:
> 
>  function setCurrentDevGroup($devID) {
>global $adb;
>/// rest of function
>  }

Yes, that was it. And also that I had misplaced the function in my gigantic
include file. Now it does what it is supposed to do, almost.

function setCurrentDevGroup($devID)
 {
$query = "SELECT dev_group FROM tracking WHERE (computer = $devID)";
$sth = $adb->prepare($query);
if($sth)
{
$res = $sth->execute();
$resulttable = $sth->fetchrow_hash();
$lookuptable = $resulttable["dev_group"];
//I do get a value for lookuptable here, eg printers.
return($lookuptable);
}
  }
But the value of $lookuptable isn't used in


switch ($lookuptable) {
case "computers":
   $query = "SELECT name FROM computers 
WHERE (ID = $this->ComputerID)";
   break;
case "printers":
   $query = "SELECT name FROM printers 
WHERE (ID = $this->ComputerID)";
   break;

}

(And yes I suppose you could write that as
"SELECT name from $lookuptable WHERE ";

What am I missing now?

/Martin S.

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




[PHP] Function misfunction - 2

2002-12-30 Thread Martin S
NOW what am I doing wrong??

function setCurrentDevGroup($devID)
 {
$query = "SELECT dev_group FROM tracking WHERE (computer = $devID)";
$sth = $adb->prepare($query);
if($sth)
{
$res = $sth->execute();
$resulttable = $sth->fetchrow_hash();
$lookuptable = $resulttable["dev_group"];
}
echo $lookuptable; // gives e.g. printers
return $lookuptable; // will not return the value to 
  }

.
.
.
setCurrentDevGroup($this->ComputerID); // calling function
$query = "SELECT name FROM $lookuptable WHERE (ID = $this->ComputerID)";
//debug line
echo $lookuptable;   // gives an empty string.   

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




Re: [PHP] Function misfunction - 2

2002-12-31 Thread Martin S
Marek Kilimajer wrote:

> You forgot global $adb; at the beginning of your function, or use
> 
> $sth = $GLOBALS['adb']->prepare($query);

Nope sorry, I've just edited it from my post here. It is in the function.

/Martin S.

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




Re: [PHP] Function misfunction - 2

2002-12-31 Thread Martin S
Jason Wong wrote:

> On Tuesday 31 December 2002 20:02, Martin S wrote:
>> Marek Kilimajer wrote:
>> > You forgot global $adb; at the beginning of your function, or use
>> >
>> > $sth = $GLOBALS['adb']->prepare($query);
>>
>> Nope sorry, I've just edited it from my post here. It is in the function.
> 
> Hmm, whenever you post code to the list you should *always* (where
> possible) copy and paste. If the code that you post is different to that
> which you are actually running then it makes it difficult for people to
> help you.
> 
> So if you can, could you please post your complete unadulterated code?
> 
This is the function which should return e.g. "printers" for $lookuptable. 
But doesn't.

function setCurrentDevGroup($devID)
{
global $adb;
$query = "SELECT dev_group FROM tracking WHERE (computer = $devID)";
$sth = $adb->prepare($query);
if($sth)
{
$res = $sth->execute();
$resulttable = $sth->fetchrow_hash();
$lookuptable = $resulttable["dev_group"];
// DEBUG
echo $lookuptable; // this give the correct value

}
return $lookuptable;
}

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




Re: [PHP] Function misfunction - 2

2002-12-31 Thread Martin S
Jason Wong wrote:

> On Tuesday 31 December 2002 20:48, Martin S wrote:
> 
>> This is the function which should return e.g. "printers" for
>> $lookuptable. But doesn't.
>>
>> function setCurrentDevGroup($devID)
>> {
>> global $adb;
>> $query = "SELECT dev_group FROM tracking WHERE (computer =
>> $devID)"; $sth = $adb->prepare($query);
>> if($sth)
>> {
>> $res = $sth->execute();
>> $resulttable = $sth->fetchrow_hash();
>> $lookuptable = $resulttable["dev_group"];
>> // DEBUG
>> echo $lookuptable; // this give the correct value
> 
> So here $lookuptable contains the correct value (eg "printers") ??

Correct. At this point $lookuptable contains the value of dev_group.

> 
>> }
>> return $lookuptable;
>> }
> 
> But something like:
> 
>   echo setCurrentDevGroup($devID);

That gives the correct value as well. But I wanted it as a variable 
($lookuptable) ...

What I am trying to do is:

setCurrentDevGroup($this->Computer); // call function and get a device group
switch ($lookuptable) {
case "computers":
bla bla bla
case "printers":
yada yada yada
}

However, getting the inspired moment from your post, I tried

switch (setCurrentDevGroup($this->Computer)) {
case "computers":
bla bla bla
case "printers":
yada yada yada
}

And now this part works at least.
My understanding was that the function would return a value for $lookuptable 
which was useable in the code above. This is incorrect then? 

/Martin S.


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




Re: [PHP] Function misfunction - 2

2002-12-31 Thread Martin S
Jason Wong wrote:

> If you want it so that the value of $lookuptable (in the global scope) is
> changed when you call your function then you have to do something like:
> 
>function doo($dah, $dee, $etc) {
> global $lookuptable;
> $lookuptable = "Hello world";
>   }
> 
>   doo(1, 2, 3);
>   echo $lookuptable; // prints "Hello world"
> ?>
> 
> More examples in manual > Variables > Variable scope

Yes. I tried that (or rather global $adb, $lookuptable) at one point as that 
seemed the most natural remedy. It didn't work so I abandoned it. Perhaps I 
did something else stupid. I'll re-read the docs.

Thanks for your help, and Happy New Year!

Martin S. 

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




Re[2]: [PHP] Img src

2003-01-08 Thread Martin Hudec
Hello Sean,

or try to use this:
print "";
or just
print "";
  ^ ^^
^ - use \ before "
^^- no need to use both \ and " remove those two characters

or try this

your php
?>
" width=104 height=137>
http://www.corwin.sk

PGP key fingerprint  21365ca05ecfd8aeb1cf19c838fff033

"In those days spirits were brave, the stakes were high, 
 men were real men, women were real women and small furry 
 creatures from Alpha Centauri were real small furry creatures 
 from Alpha Centauri."

by Douglas Adams

Wednesday, January 8, 2003, 8:55:08 PM, you wrote:

SB> Ezequiel Sapoznik wrote:
>> I am having a parse error in the following sentence:
>> 
>>   print "";
>> 

SB> it would help if you posted the actual error message !

SB> but try this ...

SB> print '';

SB> or

SB> print "";

SB> -- 

SB> Sean


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




Re[2]: [PHP] Img src CORRECTION

2003-01-08 Thread Martin Hudec
Hello Sean,

oh i must correct myself ;)) .

or try to use this:
print "";
or just
print "";

looks like u have error here:
print "";
  ^ ^^
^ - use \ before "
^^- no need to use both \ and " remove those two characters

or try this

your php
?>
" width=104 height=137>
http://www.corwin.sk

PGP key fingerprint  21365ca05ecfd8aeb1cf19c838fff033

"In those days spirits were brave, the stakes were high, 
 men were real men, women were real women and small furry 
 creatures from Alpha Centauri were real small furry creatures 
 from Alpha Centauri."

by Douglas Adams

Wednesday, January 8, 2003, 8:55:08 PM, you wrote:

SB> Ezequiel Sapoznik wrote:
>> I am having a parse error in the following sentence:
>> 
>>   print "";
>> 

SB> it would help if you posted the actual error message !

SB> but try this ...

SB> print '';

SB> or

SB> print "";

SB> -- 

SB> Sean


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




Re: [PHP] strange problem (user poll)

2003-01-08 Thread Martin Hudec
Hello Paul,

well problem is this: you don't have defined variable $actionmaybe
you are not posting it correctly from form...what is on first 12
lines?

try to add $action="value"; on line 12...just define any suitable
value...

-- 
Best regards,
 Martin  mail   [EMAIL PROTECTED]
 mobile +421.907.303.393
 icq34358414
 wwwhttp://www.corwin.sk

PGP key fingerprint  21365ca05ecfd8aeb1cf19c838fff033

"In those days spirits were brave, the stakes were high, 
 men were real men, women were real women and small furry 
 creatures from Alpha Centauri were real small furry creatures 
 from Alpha Centauri."

by Douglas Adams

Wednesday, January 8, 2003, 11:43:12 PM, you wrote:

PF> Can anyone see a problem in this?  When i run the script i am getting this
PF> error "Notice: Undefined variable: action in
PF> C:\www\Apache2\htdocs\user_poll\2\addpoll.php on line 13"

PF>  // addpoll.php
PF> // Case Study 1: User Poll - Foundation PHP for Flash

PF> // If the form has been submitted...
PF> (line 13) if ($action == "add") {
PF> // Include config file
PF> include('common.php');

PF> // Connect to database
PF> $link = dbConnect();

PF> // Get date for new poll
PF> $posted = time();

PF> // Build query to insert new poll
PF> $query = "INSERT INTO polls (question, option1, option2, option3,
PF> posted)
PF>   VALUES('$question', '$option1', '$option2', '$option3',
PF> $posted)";

PF> // Execute query
PF> $result = @mysql_query($query);

PF> // If query failed...
PF> if (!$result) {
PF> // Display error
PF> print "Could not insert poll\n";
PF> } else {
PF> print "Poll added\n";
PF> }

PF> mysql_close($link);
PF> }
?>>
PF> please anyone


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




[PHP] output of calling grep lr

2003-01-09 Thread Martin Hudec
Hello all,

i am executing grep command from php to get listing of files
containing searched phrase
i am getting output like this:

a/x.txt a/y.txt b/z.txt

I am unable to find any way to replace spaces for \n character using
ereg_replace(), I tried to replace / instead and it replaced it in
last filepath...so i am wondering..am I getting output in one "line"?
Or what?

I was also considering PassThru() but it is not suitable for my needs,
because it generates binary data.

Can anyone help me please?

I have RedHat as webserver, so linux environment :)
source is here:




-- 
Best regards,
 Martin  mail   [EMAIL PROTECTED]
 mobile +421.907.303.393
 icq34358414
 wwwhttp://www.corwin.sk

PGP key fingerprint  21365ca05ecfd8aeb1cf19c838fff033

"In those days spirits were brave, the stakes were high, 
 men were real men, women were real women and small furry 
 creatures from Alpha Centauri were real small furry creatures 
 from Alpha Centauri."

by Douglas Adams


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




[PHP] searching for string inside document

2003-01-09 Thread Martin Hudec
Hello,

i have document in html and i want to get out string between 
tags to put it into another variable..

i am wondering if i could use eregi() herebut how? I cant figure
out any possible way... same with strchr() and strstr()

can anyone help me please?

-- 
Best regards,
 Martin  mail   [EMAIL PROTECTED]
 mobile +421.907.303.393
 icq34358414
 wwwhttp://www.corwin.sk

PGP key fingerprint  21365ca05ecfd8aeb1cf19c838fff033

"In those days spirits were brave, the stakes were high, 
 men were real men, women were real women and small furry 
 creatures from Alpha Centauri were real small furry creatures 
 from Alpha Centauri."

by Douglas Adams


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




[PHP] Which country?

2003-01-20 Thread Martin Thoma
Hello!

Is there a way to get to know from which country a user is calling the
webside with my php-script?

Martin



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




[PHP] Getting https-page

2003-01-20 Thread Martin Thoma
Hello!

You can easily get an webpage with:
 $fp = fopen("http://www.mydomain.com/";, "r");
 if ($fp) exit;
 while(!feof($fp))
 { $line .= fgets($fp, 4096);
 }
 fclose($fp);
 print $line;

But this doesn't work with https (SSL). How can I get an https-page?

Martin


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




[PHP] Re: simple date question

2003-01-20 Thread Martin Thoma
Hi Adria,

why not just using  $month=date("m")?

Martin




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




[PHP] Re: Freshmeat question

2003-01-20 Thread Martin Thoma
Well, it's quite easy: Just write a php-script and start it with php myscript.php. 
Thats all.

You could fetch a web-page with fopen:
$fp = fopen("http://www.mydomain.com/";, "r");
$line = "";
 while(!feof($fp))
 { $line .= fgets($fp, 4096);
 }
 fclose($fp);
 print $line;

If you are new in programming, I think PHP is easyier to learn than Perl.

Martin



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




[PHP] Re: Freshmeat question

2003-01-21 Thread Martin Thoma
> I am not new to programming, just to scripting languages. I have seen that Perl has 
>some high advanced sintaxes for string processing, for example, but I don't know if 
>the same level can also be achieved in PHP...?

Sorry, I don't know that. I know that Perl has some regular-expressions, but php has 
this, too.

> As for the script below, could I run it inside a (my) browser? This could be in any 
>browser?

Well, it depends ;-) Generally: Yes. But you have to let a web-browser (like apache) 
process the php-script.

Martin


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




Re: [PHP] Disable pic copy/save?

2003-01-23 Thread Martin Hudec
H it might be done by checking which mouse button is pressed using 
javascript :) but i think this works only in Iexplore ;)...i used such code 
on my webpageit shows only copyright etcanyway user does not need to 
rightclik and save if he knows where is his browser cache located.

Martin


On Thursday 23 January 2003 10:57 am, Jason Wong wrote:
> On Thursday 23 January 2003 17:52, Anthony Rodriguez wrote:
> > Hi!
> >
> > A client wants to test market two versions of an advertising but wants to
> > disable the users' ability to copy/save the ads (right click, copy/save).
> >
> > How can this be done in PHP?
>
> It can't be done, period. You need to get the data to the browser for it to
> be displayed. Once it's on the user's browser a determined user will be
> able to save whatever it is that's being displayed.


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




[PHP] Beginners question

2003-02-09 Thread Martin Purdy
Hi everybody

I am totally new to PHP, and I have a problem with the Print statement.
When I send a newline using "\n" nothing happens.

I cannot get any linebreaks into my code.

The following line is copied from the PHP Manual, and is sopposed to give me
the text split into 3 lines, but they come out as one line.

echo "This spans\nmultiple lines. The newlines will be\noutput as
well.";

Can someone please tell me what I am doing wrong?

Martin Purdy



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




Re: [PHP] Beginners question

2003-02-09 Thread Martin Purdy
How do you use the output on a webpage then?

Martin




"Leif K-Brooks" <[EMAIL PROTECTED]> skrev i en meddelelse
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> My guess is that the new lines are there, but since you're (most likely)
> outputting HTML, you don't see them.  Take at look at the br HTML tag.
>
> Martin Purdy wrote:
>
>  >Hi everybody
>  >
>  >I am totally new to PHP, and I have a problem with the Print statement.
>  >When I send a newline using "\n" nothing happens.
>  >
>  >I cannot get any linebreaks into my code.
>  >
>  >The following line is copied from the PHP Manual, and is sopposed to
> give me
>  >the text split into 3 lines, but they come out as one line.
>  >
>  >echo "This spans\nmultiple lines. The newlines will be\noutput as
>  >well.";
>  >
>  >Can someone please tell me what I am doing wrong?
>  >
>  >Martin Purdy
>  >
>  >
>  >
>  >
>  >
>
> --
> The above message is encrypted with double rot13 encoding.  Any
> unauthorized attempt to decrypt it will be prosecuted to the full extent
> of the law.
>
>
>
>



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




Re: [PHP] FTP not enabled in RedHat 7.x distro

2003-02-17 Thread Martin Marques
Quoting [EMAIL PROTECTED]:

> Hi,
> 
> Installed RPM's from RedHat (latest patches) and using PHP with Apache
> under RH7.1 Linux, lots of scripts, no problems.
> 
> The hitch is that a user just tried ftp_connect(), and got the
> "unknown function" error.
> 
> Okay, so I expected this to be a missing php.so loadable module.
> However, it appears more like an option "--enable-ftp" needs to be
> specified at _compile time_ to get it working.
> 
> Is this really the case? Does RedHat _really_ not distribute with this
> feature already on? Am I even barking up the right tree?!?

Use phpinfo() to know how your PHP was compiled. If it comes as a module, you
should see a --enable-feature=shared. Don't know it ftp support can be compiled
as shared, but

Saludos... :-)


-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-
Martín Marqués  |[EMAIL PROTECTED]
Programador, Administrador, DBA |   Centro de Telematica
   Universidad Nacional
del Litoral
-


-
This mail sent through IMP: http://horde.org/imp/

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




Re: Re[2]: [PHP] FTP not enabled in RedHat 7.x distro

2003-02-17 Thread Martin Marques
Quoting [EMAIL PROTECTED]:

> Rick,
> 
> In response to your mail of Monday 17 February 2003 at 17:46:49:
> 
> 
> Thanks for your swift response!
> 
> 
> RE> I also use Redhat 7.1 and use FTP successfully. Something in your
> RE> setup?
> 
> Well, I don't think so ... it's all fairly standard (only use RPM's)
> and the "function not found" suggests the functionality just isn't
> present. Do you have an FTP extension mentioned in your PHP.ini file?
> 
> The doc's aren't clear on this point ;)

My RH 7.3 php (distributed by RH) has --enable-ftp, so it was compiled with the
ftp support.
Check yor sintax. Could have a typo somewhere.

-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-
Martín Marqués  |[EMAIL PROTECTED]
Programador, Administrador, DBA |   Centro de Telematica
   Universidad Nacional
del Litoral
-


-
This mail sent through IMP: http://horde.org/imp/

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




Re: Re[4]: [PHP] FTP not enabled in RedHat 7.x distro

2003-02-19 Thread Martin Marques
On Mar 18 Feb 2003 16:00, [EMAIL PROTECTED] wrote:
>
> Very weird - I thought RedHat would have enabled it too. I did

When I say RH, I mean RedHat. The diference seems to be that I'm on 7.3, while 
you're on 7.1.
Still, it should be compiled with ftp support.

> copy-and-paste the problem command to check I was searching for the
> right one. Here's the error, just for clarity: -
>
> Fatal error: Call to undefined function: ftp_connect() in
> /home/www/script.php on line 2
>
> ...and the line in question is like...   
>
> Anyway, maybe I should check the RH distro. Can you run the following
> on your box for me so I can compare please?

RH = RedHat! :-)

When you run phpinfo() the output gives you the configure line with which php 
was compiled, so check there if it was or wasn't compiled with ftp support.

Saludos... :-)

-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-
Martín Marqués  |[EMAIL PROTECTED]
Programador, Administrador, DBA |   Centro de Telematica
   Universidad Nacional
del Litoral
-


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




Re: Re[6]: [PHP] FTP not enabled in RedHat 7.x distro

2003-02-19 Thread Martin Marques
On Mié 19 Feb 2003 08:54, [EMAIL PROTECTED] wrote:
>
> I was wondering if you were able to check the exact RH release of your
> PHP package, to see if it matched mine?

==> rpm -q php
php-4.1.2-7.3.6

> MM> When you run phpinfo() the output gives you the configure line
> MM> with which php was compiled, so check there if it was or wasn't
> MM> compiled with ftp support.
>
> Well, I am not 100% sure. The phpinfo() reports the following:
>
> "...tem' '--with-ftp' '--with-zlib..."
>
> ...but the doc's and the people sometimes talk about "--with-ftp" and
> sometimes talk about "--enable-ftp". It's really not quite clear.

I have '--enable-ftp' on my phpinfo().

> Certainly looks like it's _behaving_ as though it has no FTP, and I'm
> increasingly getting the impression that RH released an RPM patch that
> wasn't exactly right... I'll poke them too perhaps.

Get the source of the rpm (the one that ends at src.rpm), install it, modify 
the configure line in the php.spec file and rebuild.
Also, send a bug report to bugzilla (http://bugzilla.redhat.com).

-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-
Martín Marqués  |[EMAIL PROTECTED]
Programador, Administrador, DBA |   Centro de Telematica
   Universidad Nacional
del Litoral
-


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



[PHP] WebTV vs PHP

2003-02-26 Thread Martin Mandl
Has anybody expirienced troubles with clients using some sort of WebTV?
I got a bug report saying - sbdy using WebTV has problems with our 
sites. We are using pure PHP - no JAVA, no JAVAScript ... Thus it's 
puzzling. The only thing I are sessions. However they are working also 
with cookies switched off 

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


Re: [PHP] newbie: installing gd in php4

2003-02-26 Thread Martin Mandl
just make sure, the php_gd.dll is in the directory where all your other 
php-dlls are ...

-Original Message-
Using MS Win 98 / PHP 4 and Apache.
What is the best way to install php_gd.dll so that I can make use of the
image library.


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


[PHP] Re: Too many connections - MySQL

2003-02-26 Thread Martin Mandl
don't use persitent connections ... that will solve your problem

Stephen Craton wrote:

On this site, www.roempire.com, which we host, they are having problems with too many connections. I think that someone messed with the GRANT option. How can we reverse this and allow unlimited connections per site? Or is this a problem with the script?

Thanks,
Stephen Craton
http://www.melchior.us


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



[PHP] functions and

2003-03-03 Thread Martin Johansson
Hi
I want to call a function logout() inside an  statement:

\">logout



but this doesnt work.. how shall I do it
/M



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



[PHP] Re: functions and

2003-03-03 Thread Martin Johansson
Ok to make it simplier, this is what I wanna do!

Logout";

function logout()
{
.
}

?>

How do I do it!!!

/M

> Hi
> I want to call a function logout() inside an  statement:
>
> \">logout
>
>  function logout()
> {
> 
> }
> ?>
>
> but this doesnt work.. how shall I do it
> /M
>
>



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



Re: [PHP] Re: functions and

2003-03-03 Thread Martin Johansson
it logs somone out of a session..

"Ray" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
does the function logout() log someone out of a session, or does it return
the url for where they go to logout?

and what about it isn't working?

On Monday 03 March 2003 16:32, you wrote:
> Ok to make it simplier, this is what I wanna do!
>
> 
> echo "Logout";
>
> function logout()
> {
> .
> }
>
> ?>
>
> How do I do it!!!
>
> /M
>
> > Hi
> > I want to call a function logout() inside an  statement:
> >
> > \">logout
> >
> >  > function logout()
> > {
> > 
> > }
> > ?>
> >
> > but this doesnt work.. how shall I do it
> > /M



-- 
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] what the hell in this sql

2003-03-12 Thread Martin Mandl
Nevertheless the $ looks weard ...

George Pitcher wrote:
Firstly,

This isn't a php question and should be directed at a sql list or to php-db

Have you lokked at erro 1064 in the manual? What does it say?

There are several things that you should do before coming to the list with a
problem.
Without checking I suspect that you need to specify a 'JOIN' in your
statement - again refere to the manual for instructions.
George


-Original Message-
From: Alawi [mailto:[EMAIL PROTECTED]
Sent: 12 March 2003 11:07 am
To: [EMAIL PROTECTED]
Subject: [PHP] what the hell in this sql


 SELECT * FROM cont_types, cont_data, cont_cats
 WHERE cont_data.cont_id = $cont_id
 AND cont_types.type_id = cont_data.type_id
 AND cont_cats.cat_id = cont_data.cat_id
its not work , give me 1064


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


Re: [PHP] PDF - PHP (on the fly using templates??)

2003-03-12 Thread Martin Mandl
it's not possible (at the moment) to manipulate existing pdf-files with 
fpdf.

Rives Sergio Sofrecom wrote:
maybe the link didn't work... www.fpdf.org
sorry


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


[PHP] Re: how to uploads files

2003-03-12 Thread Martin Mandl
try the following ...

http://www.faqts.com/knowledge_base/index.phtml/fid/62

Luis A wrote:
hi every one :)

how can i uploads files to my server by php script ?
any hand on that i realy apreciate 

Thanks 
__
Luis Atala 
Profetional Web Desinger
Facultad de Cultura Fisica
Linux User#: 412375
ICQ#: 132736035
  Current ICQ status: 
+  More ways to contact me 
__




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


[PHP] string validating

2003-03-12 Thread Martin Dziura
hi,

im sort of new to php, and i have the following question.

im reading in a string from a database, this string will become a file name. 
so i need to strip everything BUT lowercase a-z and 0-9. well im strtolower 
so i dont need to worry about upper case. blank spaces get replaced with _

i was trying chr() to change all unwanted chars.

TIA
Martin


_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*   
http://join.msn.com/?page=features/junkmail

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


[PHP] Re: need a new challenge

2003-03-14 Thread Martin Mandl
there were some nice threads last week:
  - formating the input of a name:
eg:  stuart o'neil   -> Stuart O'Neil
 RONALD MCDONALD -> Ronald McDonald
 serge d'avignon -> Serge d'Avignon
 von Braun   -> von Braun
... implementing that for all possible langugae struktures ...
  - another was formating street names

Php-Editors.Com wrote:
Im looking for ideas for a 2 programming contests.
What I need is a very basic challenge - that new php programmers can 
do, but involves them mixing there thinking/programming and creative 
abilities.
I also need a challenge for professional programmers - something that 
involves lots of thought, tests their problem solving ability and code 
useage.
I would be very glad to hear your ideas on this.

Stuart


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


Re: [PHP] Re user Identifying

2003-03-14 Thread Martin Mandl
The problem you are describing is implemented in a quite amazing GPL 
shop. You might want to have a look: www.oscommerce.org

Regards Martin

Peter Goggin wrote:
I did not make my request for information clear. The two scenarios which I
have to cover:
1. The user registers as a customer with the site. In this case the shopping
basket and items can be attached to the customer Id. and the shopping basket
made available across sessions. The shopping basket is created when the
first item is added. It is closed when the final order is placed.  I have
already coded this and it works satisfactorily.
2. The user does not register. Instead the process is to add items to a
shopping basket, which is then converted to an order or discarded at the end
of the session. How do I identify shopping baskets belonging to different
concurrent users?  Should I include the session Id in the record, use
cookies or what?
Is the php session Id a unique ID ?

Regards

Peter Goggin


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



[PHP] static vars question

2003-05-31 Thread Martin Helie
Sorry if this is completely stupid, but can anyone explain this, assuming
the following code:

function test() {
static $i = 0;

if( $i < 10 ) {
$i++;
test();
}
echo "I'm here";
}

test();

I am a little surprised to find that even when $i < 10 and test() is invoked
again, the current function call executes all the way through to echoing
"I'm here".

I would've thought current execution would be terminated as soon as the
function is called again, and that I'd get "I'm here" only once we're out of
the loop (ie, $i == 10).

Thanks for any pointers.

Martin Helie



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



Re: [PHP] static vars question

2003-05-31 Thread Martin Helie
> Why? The "I'm here" line is outside the conditional. The function will
> still complete independent of the conditional. If $i is greater than ten,
> the pointer just skips the contents of the if/then and continues on the
> next line after it. Here's a better illustration:

In my test() function, I called test() again inside the if statement (which
checks true for 10 iterations), and I thought that the current function
would immediately be terminated by calling itself (or any other function
that doesn't return) again and never actually echo "I'm here" until the
condition wasn't met, therefore the function not called again.

No?

>
> function gooble($alGore) {
> echo "This is a ";
> if ($alGore!="President") {
> echo "longer ";
> }
> echo "sentence.";
> }
> gooble("Vice President");
> gooble("Crazy Mountain Man);
> gooble("President");
>
> If you want the function to terminate when the conditional is false, then
> you need an Else statement to do so, otherwise it's going to keep going.
>
> --
> 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



Re: [PHP] static vars question

2003-05-31 Thread Martin Helie
Hi Steve,

yes, I am familiar with these concepts; I am just starting to experiment
with recursive functions and static variables. Thanks for explaining that
once the function is called and completed, the rest of the first call
continues executing normally. That is what surprised me.

Martin

> No. I told you, that "I'm here" is going to execute any time you call that
> function because it's OUTSIDE the if statement. Only statements inside the
> if are affected by its conditional. Once the pointer gets to the if, it's
> going to check the conditional and, if it's true, as it is the first 10
> times you go through the function, then it will run whatever's inside. If
> it's not true, the pointer will look for an else statement to execute, and
> then resume running all of the other lines in the function. If you want a
> block of code to not run until the conditional is false, then you want to
> use an ELSE statement, you don't want to just drop your code after your
if,
> it doesn't work that way.
>
> I suggest reading up more on user-defined functions and what terminates
them
>
> http://www.php.net/manual/en/functions.php#functions.user-defined
>
> And if/then statements
>
> http://www.php.net/manual/en/control-structures.php#control-structures.if
> --
> 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



Re: [PHP] static vars question

2003-05-31 Thread Martin Helie
Ernest,

I'm not _that_ clueless :-)

As I said, since I was recursing through the function by calling it numerous
times in the middle of its execution, and since the function didn't
explicitly return, I didn't expect it to continue past each call. That's
all!

Martin

Ernest E Vogelsinger <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> At 00:27 31.05.2003, Martin Helie said:
> [snip]
> >yes, I am familiar with these concepts; I am just starting to experiment
> >with recursive functions and static variables. Thanks for explaining that
> >once the function is called and completed, the rest of the first call
> >continues executing normally. That is what surprised me.
> [snip]
>
> Martin,
>
> then you should be surprised that message based systems work at all -
stuff
> like XWin, and (yes ;->) even Windoze work exactly like this. Thanks
heaven
> that language inventors allow functions to continue after they call
> others... Maybe you mixed this up with gotos, these never return. Thanks
to
> Andi Gutman and Zeev Suraski that there's no goto in PHP *smile*
>
>
> --
>>O Ernest E. Vogelsinger
>(\)ICQ #13394035
> ^ http://www.vogelsinger.at/
>
>



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



[PHP] Re: Adding graphics library

2003-05-31 Thread Martin Helie
Well, not necessarily, since gd is included with php 4.3.x. You'll probably
still want to get libjpeg and libpng, and link against them with the proper
configure options.



 <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> --with-gd and of oucrce you need the GD library.
>
> "Todd Cary" <[EMAIL PROTECTED]> escribió en el mensaje
> news:[EMAIL PROTECTED]
> > I am new to Linux so I need some help for installing the graphics
> > library.  This is what I did to get PHP to inlcude Interbase.
> >
> >!! Configure PHP with Interbase with apxs
> >34  ./configure --with-apxs=/usr/sbin --with-interbase=/opt/interbase
> >35  ./configure --with-interbase=/opt/interbase --with-apxs=/usr/sbin
> >36  ./configure --with-interbase=/opt/interbase
> > --with-apxs=/usr/sbin/apxs
> >
> > What do I need to add to this to include the graphics library?
> >
> > Many thanks...
> >
> > Todd
> >
> >
>
>



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



[PHP] Re: Long screen display cut short.

2003-05-31 Thread Martin Helie
Well, I don't know if this might be it, but a while back, I had problems
with apache + php (forget which version) and a bug in php that cause memory
problems.

I was using an array to store fairly large amounts of data. What would
happen is something similar to what you describe. Modifying the code to
avoid using an array solved the problem. Have not had the problem since
upgrading php.

Martin

Floyd Baker <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Hello...
>
> I have a routine that works fine on local win98 but when it runs on
> linux online, the screen output is cut short.  I have lengthened the
> 30 second script time max to 45 but that made no difference at all.
>
> Depending on the particulars, the routine stops at a certain spot.  If
> it is rerun, it stops at the very same spot again.  Putting in other
> particulars cause it to stop at a different point, further down.  It
> seems that changes which affect the number of mysql calculations, make
> some difference in the length of the screen display, but it's only a
> minor amount.  It cuts off somewhere around 4 pages.
>
> Any ideas please.
>
> Floyd
>
> --



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



Re: [PHP] Re: Adding graphics library

2003-06-01 Thread Martin Helie
This is what I used that is relevant:

 --with-png-dir=../libpng-1.2.5/ --with-zlib-dir=../zlib-1.1.4/ --with-jpeg-
dir=../jpeg-6b/ --with-gd

of course, the paths for libpng, zlib and jpeg will probably be different
for you.

"Todd Cary" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
<<<

You'll probably
still want to get libjpeg and libpng, and link against them with the proper
configure options.

>>>
What is the correct syntax to do all of the suggestions?

Todd



Martin Helie wrote:

Well, not necessarily, since gd is included with php 4.3.x. You'll probably
still want to get libjpeg and libpng, and link against them with the proper
configure options.



 <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

--with-gd and of oucrce you need the GD library.

"Todd Cary" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]

I am new to Linux so I need some help for installing the graphics
library.  This is what I did to get PHP to inlcude Interbase.

   !! Configure PHP with Interbase with apxs
   34  ./configure --with-apxs=/usr/sbin --with-interbase=/opt/interbase
   35  ./configure --with-interbase=/opt/interbase --with-apxs=/usr/sbin
   36  ./configure --with-interbase=/opt/interbase
--with-apxs=/usr/sbin/apxs

What do I need to add to this to include the graphics library?

Many thanks...

Todd










-- 




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



[PHP] defect tracking systems

2003-06-26 Thread Martin Balcar
Hi,
I want to begin to use some of bug tracking systems. I think it can help me
with developing more robust applications and make an easier communication
with my clients. I have tried to use Bugzilla, but It was a little bit
complicated system.

Please help me to choose some

Regards
Martin



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



Re: [PHP] defect tracking systems

2003-06-26 Thread Martin Balcar
Hm, good answer ;)

Can you recommend one of them? Do you have experience with some of these
systems?
I don't want to try them all....

Martin

"Jay Blanchard" <[EMAIL PROTECTED]> píse v diskusním
príspevku news:[EMAIL PROTECTED]
[snip]
Please help me to choose some
[/snip]

Google for bug tracking system
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=bug+tracking+syst
em

HTH



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



Re: [PHP] defect tracking systems

2003-06-26 Thread Martin Balcar
My fault...
I would run it on Apache, mySQL using PHP technology
And the system should be simple.

I admire Bugzilla project, but it seems to be very complicated ;(

Martin

"Jay Blanchard" <[EMAIL PROTECTED]> píse v diskusním
príspevku news:[EMAIL PROTECTED]
[snip]
Hm, good answer ;)

Can you recommend one of them? Do you have experience with some of these
systems?
I don't want to try them all

[snip]
Please help me to choose some
[/snip]

Google for bug tracking system
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=bug+tracking+syst
em
[/snip]

It would be hard for me to make a recommendation since I do not know
what kind of requirements you have for a system such as this.

HTH



-- 
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] about writing permissions

2003-07-08 Thread Martin Hudec
Hello,

On Tuesday July 8 2003 15:42, George Papatheodorou wrote:
> I noticed that in all versions before php5 (I haven't seen this one
> yet), a script cannot open a file for writing mode is the file's
> owner is different from php's owner.  

if user2 other than owner is trying to write to file which does not have 
permission to write for group in which user2 is, or write for others, 
then write will fail

like in

rw-r--r-- user group file.txt
only user has permission to write

or in

rw-rw-r-- user group file.txt
only user and users attached to group have permission to write...

> Eg when php's owner is apache
> and test.php's owner is user1, user1's script cannot write in
> test.php but it can write to test2.php which is owned by apache. 

All scripts on webserver run with owner/uid of apache (like nobody, 
apache or such), therefore you have to set correct permissions to 
files

if test.php is set to rw-r--r-- user1 group then only user1 is allowed 
to write to it

test2.php is set to rw-r--r-- apache group... so apache can write there

> there any solution to this problem? (except making apache own all
> files). Sorry if my question is kinda newbish or stupid and sorry for
> my poor english too. Thank you in advance.

solution is to set all files to be writable by group (rw-rw-r--) by 
chmod 664 and add apache owner/uid to group which is listed as 
ownergroup of that file (change group id of apache in its configuration 
file to group).

like

rw-rw-r--  user group test.php


I hope I have explained it a bit to you.

-- 
Martin Hudec

 :@:  [EMAIL PROTECTED]
 :w:  http://www.corwin.sk
 :m:  +421.907.303.393

  "In google non est, ergo non est."
  - unknown IRC operator


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



[PHP] problem: creating global alias inside function

2003-07-28 Thread Martin Peck
The following code illustrates a problem I've got with references (running
on PHP 4.3.2).  Can anyone explain it for me?  Thanks in advance for any
assistance!
Martin




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



Re: [PHP] uploading a file from a form

2003-07-28 Thread Martin Peck
Amanda,
You need to look at some of the error messages that are available to you:

1) remove the prepended @ from the file functions. This will tell what is
going wrong with the file copy.
>  if ([EMAIL PROTECTED]($photo, $long_path . "company_logo/" . $photo_name)) {
>  echo "Copy failed.";

2) use mysql_error() when you sql query fails rather than just die() ing
>$add_image_query .= "UPDATE apt_company_t set
>company_logo_path='$photo_path', ";
>$add_image_query .= "WHERE company_cd = $company_id[0]";
>mysql_query($add_image_query) or die("Update Failed!");

As Curt Zirzow has suggested, it looks to me like your mysql syntax is at
fault here. mysql_error() will have told you about it.  You have a ', '
where you shouldn't have one

Martin

- Original Message -
From: "Marek Kilimajer" <[EMAIL PROTECTED]>
To: "Amanda McComb" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 3:43 PM
Subject: Re: [PHP] uploading a file from a form


> Everything is in the manual:
> http://www.php.net/features.file-upload
>
> Amanda McComb wrote:
>
> > I'm not sure what that means...how do I use it, and where?
> >
> > On Fri, 25 Jul 2003, Marek Kilimajer wrote:
> >
> >
> >>Don't you need to use $HTTP_POST_FILES array because you have
> >>register_globals off?
> >>
> >>Amanda McComb wrote:
> >>
> >>
> >>>I am having a problem with uploading a file from a form.  I changed the
> >>>permission on the directory, but I am still getting an error.  Here is
my
> >>>error:
> >>>
> >>>Copy failed./home/vencel/www/images/apt/company_logo/14Update Failed!
> >>>
> >>>It looks like it's not finding the file type.  Here is my code:
> >>>
> >>>
> >>> >>>$long_path = "/home/vencel/www/images/apt/";
> >>>$short_path = "../images/apt/";
> >>>
> >>>if (($REQUEST_METHOD=='POST')) {
> >>>   for(reset($HTTP_POST_VARS);
> >>>  $key=key($HTTP_POST_VARS);
> >>>  next($HTTP_POST_VARS)) {
> >>> $this = addslashes($HTTP_POST_VARS[$key]);
> >>> $this = strtr($this, ">", " ");
> >>> $this = strtr($this, "<", " ");
> >>> $this = strtr($this, "|", " ");
> >>> $$key = $this;
> >>>   }
> >>>
> >>>
> >>>//Check for form fields, insert them.
> >>>
> >>>//Pull out the id auto-incremented from previous insert.
> >>>
> >>>
> >>>//Check to see if a full-sized photo was uploaded
> >>> if ($photo == "none") {
> >>>echo "No photo.";
> >>>} else {
> >>>  $end = strrchr($photo_name, ".");
> >>>echo $end;
> >>>  $new_photo_name = $company_id[0] . $end;
> >>>
> >>>  if ([EMAIL PROTECTED]($photo, $long_path . "company_logo/" . $photo_name)) {
> >>>  echo "Copy failed.";
> >>>  echo $long_path . "company_logo/" . $photo_name;
> >>>echo $new_photo_name;
> >>>
> >>>  } else {
> >>>$long_photo_path = $long_path . "company_logo/" .
$new_photo_name;
> >>>$photo_path = $short_path . "company_logo/" . $new_photo_name;
> >>>
> >>>if ([EMAIL PROTECTED]($long_path . "logo/" . $photo_name,
> >>>   $long_photo_path)){
> >>>   echo "Full sized photo not renamed.";
> >>>}
> >>>  }
> >>>}
> >>>$add_image_query .= "UPDATE apt_company_t set
> >>>company_logo_path='$photo_path', ";
> >>>$add_image_query .= "WHERE company_cd = $company_id[0]";
> >>>
> >>>mysql_query($add_image_query) or die("Update Failed!");
> >>>
> >>>
> >>>}
> >>>} ?>
> >>>>
> >>>
> >>>
> >>>Use the Browse button to locate your file on
> >>>your computer or local network.
> >>>
> >>>
> >>>Company Logo File:   >>>size="30">
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>Any ideas?
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


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



[PHP] strange foreach behaviour

2003-08-05 Thread Martin Peck

I have come up against a very strange problem.  I currently have no idea how
to even approach attempting to fix it...


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



[PHP] Re: strange foreach behaviour

2003-08-05 Thread Martin Peck
My apologies for the last post - somehow managed to send whilst attempting
to copy and paste... d'oh.
I'd like to try again.

I have come up against a very strange problem.  I currently have no idea how
to even approach attempting to fix it...

In the following code snippet, $this->items is an array of objects - each of
these objects is one of two object types (with similar interfaces).  There
is nothing that unusual in the these few lines:

foreach ($this->items as $code => $item) {
var_dump($this->items[$code]);
var_dump($item);
etc.
}

but after successfully calling this piece of code a number of times in my
application, I get the following output:

object(citem)(2) {
  ["q"]=>
  int(1)
  ["c"]=>
  string(3) "157"
}
NULL
Fatal error: Call to a member function on a non-object in
/var/www/local/ge/include/product.php4 on line 58

I have no comprehension how it is that the two var_dump() commands can
produce different outputs.  Can anyone suggest what sort of thing I need to
be looking at?!

Any help very gratefully received,
regards,
Martin


-- 
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] segmentation faults

2003-08-14 Thread Martin Peck
hi,

I have a large project underway which is (hopefully!) nearing completion,
running on the latest stable release, 4.3.2.  However, strange things have
started happening...

My main page sometimes causes Apache to seg fault at some point during the
execution (e.g. [Sun Aug 10 18:05:55 2003] [notice] child pid 29674 exit
signal Segmentation fault (11)). I thought I'd track through it to find out
where the problem might be, but having sprinkled a few echo statements
around it now isn't crashing any more.

There are other oddities, too - the latest is an error caused by a static
local variable which is only ever assigned mysql result resource IDs which
for some reason seems to end up containing a string.  Needless to say, my
application isn't doing what it should and seems to be defying logic.

I'm thinking that it can only be caused by a bug somewhere in PHP that has
started causing me grief.  People on this list have surely had similar
problems at some stage or other?  What should I do?

Martin


-- 
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] segmentation faults

2003-08-14 Thread Martin Peck

Thanks for the reply.  Kind of good to know I am not the only one having
difficulties.  I too have arrays of objects - although had the problem when
I was dealing with arrays that were only 2 or 3 items long - and also am
passing references quite a bit.

After several hours of going backwards, I seem to be back on the straight
and narrow by tweaking my code so i don't read non-existant array elements.
Incase this helps anyone else down the road ever, I'll elaborate:

I have several object classes which manage arrays of objects.  They have
member functions which return references to these objects. i.e.

function &findObj($id)
{
return ($this->objarray[$id]);
}

I realised my problems started when I started passing $id=0 into these
functions.  No such id exists.  I thought this would be fine, because I was
expecting to just get NULL back, and I tested against the return value.
This did infact work, but seems to have also resulted in all the erratic
problems I described in my first post.  I have changed the functions to the
following form:

function &findObj($id)
{
if ($id)
return ($this->objarray[$id]);
}

and everything seems to be nice and stable again.  Maybe somebody who knows
the Zend code might be able to work out the cause of these problems?  Is
this the sort of thing I should send to one of the developer lists?  It
would be nice to have the time to have a look myself, but my deadline is
looming ominously so I need to crack on for now ...

thanks again for the response,
regards,
Martin

- Original Message - 
From: "Mike Migurski" <[EMAIL PROTECTED]>
To: "Martin Peck" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, August 10, 2003 8:57 PM
Subject: Re: [PHP] segmentation faults


> >I have a large project underway which is (hopefully!) nearing completion,
> >running on the latest stable release, 4.3.2.  However, strange things
> >have started happening...
> >
> >My main page sometimes causes Apache to seg fault at some point during
> >the execution (e.g. [Sun Aug 10 18:05:55 2003] [notice] child pid 29674
> >exit signal Segmentation fault (11)). I thought I'd track through it to
> >find out where the problem might be, but having sprinkled a few echo
> >statements around it now isn't crashing any more.
>
> I have also had this problem, and asking about it here provided no help.
>
> Mine seems to be related to abnormally high numbers of instantiated
> objects and large amounts of reference-passing. Occasionally Apache
> children will die (with the error you've described), or spin out of
> control and hog the CPU for a while (Apache 1.3.27, Red Hat 9, PHP 4.3.2).
> I have not been able to track down the problem, though I did attempt to
> re-create it using the command-line PHP interpreter to write Apache out of
> the picture, and was not able to reproduce the errors.
>
> I've tried to route around them somewhat, and have been moderately
> successful, except when they bump my CPU load to 100%. :-P
>
> -
> michal migurski- contact info and pgp key:
> sf/cahttp://mike.teczno.com/contact.html
>
>
> -- 
> 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] segmentation faults

2003-08-14 Thread Martin Peck
- Original Message -
From: "Tom Rogers" <[EMAIL PROTECTED]>
> Most programs will crash with null pointers so I operate with error
> reporting set to E_ALL and it helps when these sort of things happen.
> A function should never trust what it is being fed :) so your solution
> is the right way, I don't think you will get much sympathy from the
> developers but it would not hurt to tell them.

One of the first things I did was change the error reporting to E_ALL (and
now have it on E_ALL permanently), but I initialise all my variable names
(not the same thing as accessing unassigned array elements) so this didn't
produce anything.

- Original Message -
From: "Curt Zirzow" <[EMAIL PROTECTED]>
> Before screaming bug at the developers I would strongly suggest:
>
>  . making a very simple example of code that can reproduce (or in
>  this case irraticly reproduce) the crash.

The problem with all this, as Mike has suggested, is that the errors you get
change as you change totally unrelated parts of the code - reducing it down
seems likely to "fix" them even if I leave in the bits that I suspect cause
it!  Hopefully I'll have a bit of time to see what I can do, though.

cheers,
Martin


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



Re: [PHP] Correct Coding

2003-08-14 Thread Martin Peck
> > That can generate an error if $Task was never assigned a value.
> >
>
> could you not do
>
> if(@$Task == "Add" ){do something }
>
> to suppress the error of the variable not being set?

I have never seen php give an error if $Task is not set to anything.  I
would have said that

if ("Add" == $Task) { Do something }

would always be fine - what am I missing?

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



[PHP] howto set locale only once

2003-08-15 Thread Martin Leja
Hi,

setting locale with setlocale() to subsequently get localized time strings
e.g. works fine. But this way the setlocale function gets executed every
time. How can i set the locale only once?
Can i specify the locale in the config file php.ini?

I'm using php as apache module on a linux debian system.

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



<    6   7   8   9   10   11   12   13   14   15   >