php-general Digest 23 Sep 2002 13:42:11 -0000 Issue 1602

Topics (messages 117221 through 117272):

Specify authentication for SMTP mailserver?
        117221 by: Joseph Szobody
        117241 by: Manuel Lemos
        117242 by: Pablo Oliva

Re: mysql password function
        117222 by: John Holmes

Re: return the amount of records in a mysql databace
        117223 by: Philip J. Newman

Re: Redirection
        117224 by: Sascha Cunz

Re: Replace linefeed/newline from text inputs with <br> tag?
        117225 by: John Holmes
        117257 by: David T-G
        117258 by: John Holmes
        117264 by: David T-G

Re: Running a PHP script automatically?
        117226 by: Sascha Cunz

Re: Cannot Redeclare?
        117227 by: Stephen Craton
        117228 by: John Holmes
        117229 by: Daniel Kushner
        117230 by: Daniel Kushner

Help with mail...
        117231 by: Chuck \"PUP\" Payne
        117232 by: John Holmes
        117233 by: Chuck PUP Payne
        117234 by: Justin French
        117250 by: John Holmes

Re: Designing N-tier applications in PHP (long)
        117235 by: Garth Dahlstrom

Comparing Alphanumeric values in a range
        117236 by: Samantha Savvakis
        117237 by: Samantha Savvakis
        117238 by: Samantha Savvakis

mysql_num_rows error
        117239 by: Nick Varner
        117243 by: Tom Rogers
        117255 by: John Holmes
        117267 by: M.A.Bond.open.ac.uk
        117268 by: Jon Haworth

Wrap content with a layout file
        117240 by: Patrick Lebon
        117246 by: Michael Egan
        117247 by: Justin French

Strange "1" after include
        117244 by: César Aracena
        117245 by: Chase Urich

Re: ASP > PHP
        117248 by: Ernani Joppert Pontes Martins

Function: return multple values
        117249 by: Faisal Abdullah
        117251 by: Jon Haworth

session_start function breaks flush function in 4.2.1
        117252 by: Chris Andrew

Re: Update undefined List Values in DB
        117253 by: Tim Ward

Safe mode and directory permission
        117254 by: Rudolf Wolf

foreach, side effect or good behaviour?
        117256 by: Jean-Pierre Arneodo
        117260 by: Stephan Seidt

== case-sensitive?
        117259 by: Hawk
        117261 by: Krzysztof Dziekiewicz
        117262 by: Jon Haworth
        117263 by: Ford, Mike               [LSS]

Confused
        117265 by: Rankin, Randy
        117266 by: M.A.Bond.open.ac.uk

URL Rewriting
        117269 by: Bill Farrell
        117271 by: Jon Haworth

How do I use a Javascript variable in PHP?
        117270 by: Tom
        117272 by: Support . Fourthrealm.com

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
I'm trying to send mail on a Windows machine using PHP. I have made the necessary 
corrections in the php.ini file for the SMTP server address, and the sendmail_from, my 
problem is that my SMTP server require authentication. How do I tell PHP to provide 
this?

Thanks!

Joseph

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

On 09/22/2002 10:45 PM, Joseph Szobody wrote:

 > I'm trying to send mail on a Windows machine using PHP. I have made
 > the necessary corrections in the php.ini file for the SMTP server
 > address, and the sendmail_from, my problem is that my SMTP server
 > require authentication. How do I tell PHP to provide this?

There is no way to do it.

You may want to try this class instead as it supports authentication as 
you need:

http://www.phpclasses.org/smtpclass

I have also a mail() function replacement based on that class and this 
other class that does a few other things too, but I haven't fully tested 
it. If you want to wait, I may upload it soon:

http://www.phpclasses.org/mimemessage


-- 

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
You can run your own SMTP server, if it helps...
http://www.postcastserver.com/  Extremely easy to set up.

--- End Message ---
--- Begin Message ---
Use this:

$result = mysql_query("SELECT PASSWORD(" . $_POST['password'] . ")");
$password = mysql_result($result,0);

or just use mysql_fetch_row() or AS in your query so you don't have to
recreate that complex column name.

---John Holmes...

> -----Original Message-----
> From: Murat Ö. [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 22, 2002 9:33 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] mysql password function
> 
> hi,
> i want to encode a string that users enter with mysql password
function.
> but
> sometimes this code works sometimes don't. mysql warns me:
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
> result
> resource in ........
> 
> the code is:
> 
> $result=mysql_query("select password(".$_POST['password'].")");
>   while ($p = mysql_fetch_array($result, MYSQL_ASSOC)):
>   $pswrd=$p['password('.$_POST['password'].')'];
>   endwhile;
> 
> thanks...
> 
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
select count(*) as n from ... where ...

This worked well for me.

----- Original Message ----- 
From: "John Holmes" <[EMAIL PROTECTED]>
To: "'Jeff Bluemel'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, September 23, 2002 1:28 PM
Subject: RE: [PHP] return the amount of records in a mysql databace


> Then do a SHOW DATABASES query before that and loop through the results,
> counting the rows in each table. 
> 
> If you have to do this, though, I think you have some normalization
> issues with your database...
> 
> ---John Holmes...
> 
> > -----Original Message-----
> > From: Jeff Bluemel [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, September 22, 2002 11:46 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] return the amount of records in a mysql databace
> > 
> > this is only going to return records in a table, and not in a database
> > 
> > 
> > > select count(*) as n from ... where ...
> > >
> > > -----Original Message-----
> > > From: Philip J. Newman [mailto:[EMAIL PROTECTED]]
> > >
> > > Can someone point me in the right direction to find out how i can
> return
> > the
> > > amount of records in a mysql databace ?
> > >
> > 
> > 
> > 
> > --
> > 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
> 

--- End Message ---
--- Begin Message ---
And also avoid including scripts that contain a linebreak or a space after any 
'?>'. When I did this first time, it took me ages to find out what was 
wrong... :-)

Sascha

Am Montag, 23. September 2002 02:07 schrieb Justin French:
> Validate the input BEFORE outputting anything to the browser... this way
> you have control over such problems.
>
> <?
> // validate
> // code
> // here
>
>
> if($valid)
>     {
>     header(...);
>     exit;
>     }
> ?>
> <HTML>
> <?
> if(!$valid)
>     {
>     echo "error on form";
>     }
> ?>
> </HTML>
>
> The code below exit; will only be executed if the input was NOT valid....
>
>
> Regards,
>
> Justin
>
> on 23/09/02 9:42 AM, Sascha Braun ([EMAIL PROTECTED]) wrote:
> > Hi,
> >
> > I want to post a form and after parsing i want to redirect the user to
> > the home page.
> >
> > header() doesn't work in this circumstance, what can I do else?
> >
> > Greetings
> >
> > Sascha

--- End Message ---
--- Begin Message ---
> If i have a textarea form input for users and they enter in return
spaces,
> how can i replace the ascci chars with html tags?

It'd be great if they had a function for this...they could call it
nl2br() or something...

www.php.net/nl2br

---John Holmes...

--- End Message ---
--- Begin Message ---
John, et al --

...and then John Holmes said...
% 
% > If i have a textarea form input for users and they enter in return
% spaces,
% > how can i replace the ascci chars with html tags?
% 
% It'd be great if they had a function for this...they could call it
% nl2br() or something...

Yeah.  It would be even cooler if that's what it did, eh?  Maybe someone
should rename that nl2nl+br and write a *real* nl2br for those of us that
want to GET RID OF the newlines.  I think that part of the reason this
question comes up often is because nl2br doesn't really do what its name
would lead us, or at least me, to think that it does.

Patrick, I just went through this a few weeks ago (Sep 06).  I don't know
that the list has archives, or I'd send you there first (anyone with a
URL?), so all I can do is give you my result:

  $fout = ereg_replace("(\n|\r)+","<br>",$fin) ;

This translates any newline and/or carriage return in your $fin string to
a <br> and puts the results in $fout.  It will convert input like

  this is
  some input

to

  this is<br>some input

and you no longer have a newline in the way.  The only downside is that

  this is

  some input

ends up the same way because the regexp is greedy, but the upside is that
it will work for UNIX (\n), Mac (\r), and DOS/Win (\r\n) input.


HTH & HAND

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

Attachment: msg79538/pgp00000.pgp
Description: PGP signature

--- End Message ---
--- Begin Message ---
Okay, you got me on that one, but why do you need to remove the
newlines? It should be stored in the database (if you're doing so) with
the  newlines and not the HTML breaks. You only use the nl2br() to
output it on a web page, so who cares if the new lines are still there?

The manual page explains this correctly, btw. It says that a "<br />"
will be inserted before all newlines.

---John Holmes...

> -----Original Message-----
> From: David T-G [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 23, 2002 7:10 AM
> To: PHP General list
> Cc: John Holmes; 'Patrick Lebon'
> Subject: Re: [PHP] Replace linefeed/newline from text inputs with <br>
> tag?
> 
> John, et al --
> 
> ...and then John Holmes said...
> %
> % > If i have a textarea form input for users and they enter in return
> % spaces,
> % > how can i replace the ascci chars with html tags?
> %
> % It'd be great if they had a function for this...they could call it
> % nl2br() or something...
> 
> Yeah.  It would be even cooler if that's what it did, eh?  Maybe
someone
> should rename that nl2nl+br and write a *real* nl2br for those of us
that
> want to GET RID OF the newlines.  I think that part of the reason this
> question comes up often is because nl2br doesn't really do what its
name
> would lead us, or at least me, to think that it does.
> 
> Patrick, I just went through this a few weeks ago (Sep 06).  I don't
know
> that the list has archives, or I'd send you there first (anyone with a
> URL?), so all I can do is give you my result:
> 
>   $fout = ereg_replace("(\n|\r)+","<br>",$fin) ;
> 
> This translates any newline and/or carriage return in your $fin string
to
> a <br> and puts the results in $fout.  It will convert input like
> 
>   this is
>   some input
> 
> to
> 
>   this is<br>some input
> 
> and you no longer have a newline in the way.  The only downside is
that
> 
>   this is
> 
>   some input
> 
> ends up the same way because the regexp is greedy, but the upside is
that
> it will work for UNIX (\n), Mac (\r), and DOS/Win (\r\n) input.
> 
> 
> HTH & HAND
> 
> :-D
> --
> David T-G                      * It's easier to fight for one's
principles
> (play) [EMAIL PROTECTED] * than to live up to them. -- fortune
> cookie
> (work) [EMAIL PROTECTED]
> http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl
> Npg!


--- End Message ---
--- Begin Message ---
John, et al --

...and then John Holmes said...
% 
% Okay, you got me on that one, but why do you need to remove the

In my case, I had a newline-delimited file of

  field@@data
  field@@data
  field@@data

and when the data had an embedded newline like

  comment@@this is a
  long comment
  field@@data

then it messed things up.  Yeah, I learned about the possibility of using
XML along the way, and I've already thought about serialize and base64
(which I *do* use inside the code, though not out in the file) for simple
protections, but a requirement was that the text file also be readable
and editable by people -- and, besides, I'm just extending this code
rather than writing it :-)


% newlines? It should be stored in the database (if you're doing so) with
% the  newlines and not the HTML breaks. You only use the nl2br() to
% output it on a web page, so who cares if the new lines are still there?

For output, it doesn't matter, as you say.  My problem was input :-)


% 
% The manual page explains this correctly, btw. It says that a "<br />"
% will be inserted before all newlines.

Yeah, but that requires actual reading ;-)  Who knows any more what TFM is?


% 
% ---John Holmes...


HTH & HAND

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

Attachment: msg79538/pgp00001.pgp
Description: PGP signature

--- End Message ---
--- Begin Message ---
> On the Linux box compile PHP as CGI (i.e. don't configure it as an apache
> mod). Then you can just run your script from the the command-line.

This is called CLI (Command Line Interface), not CGI (Common Gateway 
Interface). The CGI is called from an WebServer; CLI get's called from a 
shell-(script) or any thing.

Anyway, this is the most likely way to do this. The PHP Binaries for Windows 
already ship with a CLI-Version of PHP which lives in the root of your PHP 
folder. Most Linux Distribution have also one (I'm not using Red Hat), which 
would usually live in /usr/bin/php ( to find out, type: whereis php).
The CLI can fine be scheduled either by a Vixie-Crontab or by a windows 
scheduler task.

Sascha

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

I was just wondering...again...why the heck I keep getting this error.
I'm trying to make a function called login() and sometimes it works,
other times it hates me and gives me this error:

Fatal error: Cannot redeclare login() in
c:\apache\htdocs\wiredphp\member\funcs.php on line 5

Here's the contents of the function login():

function login($username, $password)
{
  $sql = "select * from members where username='$username' and passwd =
password('$password')";
  $result = mysql_query($sql, $wired);
  if (!$result)
     return 0;
  
  if (mysql_num_rows($result)>0)
     return 1;
  else 
     return 0;
}

Please help. I don't see why this keeps happening...

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

P.S. I'm sending this again because I don't know if the other got
through or not...


--- End Message ---
--- Begin Message ---
Funcs.php is probably being included twice at some point in your code.

---John Holmes...

> -----Original Message-----
> From: Stephen Craton [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 22, 2002 10:56 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] FW: Cannot Redeclare?
> 
> Hello,
> 
> I was just wondering...again...why the heck I keep getting this error.
> I'm trying to make a function called login() and sometimes it works,
> other times it hates me and gives me this error:
> 
> Fatal error: Cannot redeclare login() in
> c:\apache\htdocs\wiredphp\member\funcs.php on line 5
> 
> Here's the contents of the function login():
> 
> function login($username, $password)
> {
>   $sql = "select * from members where username='$username' and passwd
=
> password('$password')";
>   $result = mysql_query($sql, $wired);
>   if (!$result)
>      return 0;
> 
>   if (mysql_num_rows($result)>0)
>      return 1;
>   else
>      return 0;
> }
> 
> Please help. I don't see why this keeps happening...
> 
> Thanks,
> Stephen
> http://www.melchior.us
> http://php.melchior.us
> 
> P.S. I'm sending this again because I don't know if the other got
> through or not...
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
When including the file funcs.php use include_one().

Regards,
Daniel Kushner
____________________________________
Need hosting? http://thehostingcompany.us



-----Original Message-----
From: Stephen Craton [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, September 22, 2002 10:56 PM
To: [EMAIL PROTECTED]
Subject: [PHP] FW: Cannot Redeclare?


Hello,

I was just wondering...again...why the heck I keep getting this error.
I'm trying to make a function called login() and sometimes it works,
other times it hates me and gives me this error:

Fatal error: Cannot redeclare login() in
c:\apache\htdocs\wiredphp\member\funcs.php on line 5

Here's the contents of the function login():

function login($username, $password)
{
  $sql = "select * from members where username='$username' and passwd =
password('$password')";
  $result = mysql_query($sql, $wired);
  if (!$result)
     return 0;
  
  if (mysql_num_rows($result)>0)
     return 1;
  else 
     return 0;
}

Please help. I don't see why this keeps happening...

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

P.S. I'm sending this again because I don't know if the other got
through or not...



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




--- End Message ---
--- Begin Message ---
Typo:
include_one() === include_once()


-----Original Message-----
From: Daniel Kushner [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, September 22, 2002 11:06 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] FW: Cannot Redeclare?


When including the file funcs.php use include_one().

Regards,
Daniel Kushner
____________________________________
Need hosting? http://thehostingcompany.us



-----Original Message-----
From: Stephen Craton [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, September 22, 2002 10:56 PM
To: [EMAIL PROTECTED]
Subject: [PHP] FW: Cannot Redeclare?


Hello,

I was just wondering...again...why the heck I keep getting this error.
I'm trying to make a function called login() and sometimes it works,
other times it hates me and gives me this error:

Fatal error: Cannot redeclare login() in
c:\apache\htdocs\wiredphp\member\funcs.php on line 5

Here's the contents of the function login():

function login($username, $password)
{
  $sql = "select * from members where username='$username' and passwd =
password('$password')";
  $result = mysql_query($sql, $wired);
  if (!$result)
     return 0;
  
  if (mysql_num_rows($result)>0)
     return 1;
  else 
     return 0;
}

Please help. I don't see why this keeps happening...

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

P.S. I'm sending this again because I don't know if the other got
through or not...



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



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

Well after read php.net and my copy php 4 bible. I am lost with mail. I can
get it to work if I do this...

Mail ('[EMAIL PROTECTED]', 'Data Added',
       $fname, $lname .);

But I can't get this to work...I know someone going to call me stupid but I
am really having people with mail(), Is there a special place to put it?

Here example of my code....any way I trying to hammer it out and using
google to see where the error of my way is.

Chuck Payne


-------------------------------------------------------

<HTML>
<HEAD>
<TITLE>Killers Added</TITLE>
</HEAD>

<BODY TOPMARGIN="50">

<?php

if ($fname=="") {
    echo "You did not supply a first name. Please hit the 'Back' button on
          your browser and fill in a name.\n";
    exit;
  }
  
  if ($lname=="") {
    echo "You did not supply a Last Name. Please hit the 'Back' button on
          your browser and fill in a name.\n";
    exit;
  }
  
  if ($title=="") {
    echo "You did not supply a Movie Title. Please hit the 'Back' button on
          your browser and fill in a name.\n";
    exit;
  }
 
 $dbh = mysql_connect("deathtoasp", "zombieuser", "eatmsbrains")
         or die ("Unable to connect to database");
  mysql_select_db("slashers", $dbh)
         or die ("An error was reported");
         
  $table_name = "deathmovies";

  $statement = "INSERT INTO $table_name (fname, lname, title) VALUES
(\"$fname\", \"$lname\", \"$title\")";

  $result = mysql_query($statement, $dbh);
  
  if ($result) {
  
    echo "<H3>Adding the following record</H3>";
    echo "<hr>";
    echo "<p><strong>Actor/Actress:</strong>&nbsp;&nbsp; $fname $lname
</p>";
    echo "<br>";
    echo "<p><strong>Movie:</strong>&nbsp;&nbsp;$title</p>";
    echo "<a href='addactormovie.html'>Add more Actor/Actress and Movie
which they stared in</a>";
    echo "<hr>";
    
   $address = "[EMAIL PROTECTED]";
   $Subject = "The new movie and actor added to phpMovie Library";
   $body = "Adding the following record
            Actor/Actress: '$fname $lname'
            Movie: '$title'";

    
    mail('$address', '$Subject', '$body .');
    
  } else {
  
    echo "There was an error saving your entry. Please try back in a
    little while.";
  }
             
?>

</BODY>
</HTML>




--- End Message ---
--- Begin Message ---
Variables are not evaluated within single quotes. You are trying to send
an email to $address, literally. If you just have a single variable,
lose the quotes entirely.

Mail($address,$subject,$body);

---John Holmes...

> -----Original Message-----
> From: Chuck "PUP" Payne [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 22, 2002 11:41 PM
> To: PHP General
> Subject: [PHP] Help with mail...
> 
> Hi,
> 
> Well after read php.net and my copy php 4 bible. I am lost with mail.
I
> can
> get it to work if I do this...
> 
> Mail ('[EMAIL PROTECTED]', 'Data Added',
>        $fname, $lname .);
> 
> But I can't get this to work...I know someone going to call me stupid
but
> I
> am really having people with mail(), Is there a special place to put
it?
> 
> Here example of my code....any way I trying to hammer it out and using
> google to see where the error of my way is.
> 
> Chuck Payne
> 
> 
> -------------------------------------------------------
> 
> <HTML>
> <HEAD>
> <TITLE>Killers Added</TITLE>
> </HEAD>
> 
> <BODY TOPMARGIN="50">
> 
> <?php
> 
> if ($fname=="") {
>     echo "You did not supply a first name. Please hit the 'Back'
button on
>           your browser and fill in a name.\n";
>     exit;
>   }
> 
>   if ($lname=="") {
>     echo "You did not supply a Last Name. Please hit the 'Back' button
on
>           your browser and fill in a name.\n";
>     exit;
>   }
> 
>   if ($title=="") {
>     echo "You did not supply a Movie Title. Please hit the 'Back'
button
> on
>           your browser and fill in a name.\n";
>     exit;
>   }
> 
>  $dbh = mysql_connect("deathtoasp", "zombieuser", "eatmsbrains")
>          or die ("Unable to connect to database");
>   mysql_select_db("slashers", $dbh)
>          or die ("An error was reported");
> 
>   $table_name = "deathmovies";
> 
>   $statement = "INSERT INTO $table_name (fname, lname, title) VALUES
> (\"$fname\", \"$lname\", \"$title\")";
> 
>   $result = mysql_query($statement, $dbh);
> 
>   if ($result) {
> 
>     echo "<H3>Adding the following record</H3>";
>     echo "<hr>";
>     echo "<p><strong>Actor/Actress:</strong>&nbsp;&nbsp; $fname $lname
> </p>";
>     echo "<br>";
>     echo "<p><strong>Movie:</strong>&nbsp;&nbsp;$title</p>";
>     echo "<a href='addactormovie.html'>Add more Actor/Actress and
Movie
> which they stared in</a>";
>     echo "<hr>";
> 
>    $address = "[EMAIL PROTECTED]";
>    $Subject = "The new movie and actor added to phpMovie Library";
>    $body = "Adding the following record
>             Actor/Actress: '$fname $lname'
>             Movie: '$title'";
> 
> 
>     mail('$address', '$Subject', '$body .');
> 
>   } else {
> 
>     echo "There was an error saving your entry. Please try back in a
>     little while.";
>   }
> 
> ?>
> 
> </BODY>
> </HTML>
> 
> 
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Ok, that work. Why does the ' (quote) not make it work is it because it's an
array? Any thanks John that got it work.

--- End Message ---
--- Begin Message ---
strings in double quotes are evaluated looking for $vars and {$vars} to
substitute.  strings with in single quotes are not evaluated for vars.

$var = "my favourite color is {$col}";  // works
$var = "my favourite color is $col";    // works
$var = 'my favourite color is $col';    // doesn't work
$var = 'my favourite color is ' . $col; // works

Same applies to strings within functions:

include('{$dir}/{$file}.inc')       // doesn't work
include('$dir/$file.inc')           // doesn't work
include($dir.'/'.$file.'.inc')      // works
include("{$dir}/{$file}.inc")       // works
include("$dir/$file.inc")           // probably works

Nothing to do with arrays :)

HTH

Justin


on 23/09/02 1:52 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:

> Ok, that work. Why does the ' (quote) not make it work is it because it's an
> array? Any thanks John that got it work.
> 

--- End Message ---
--- Begin Message ---
It's just part of the rules. Variables are not evaluated when they are
between single quotes, they are between double quotes.

Echo 'This is $var';

Will output that string, literally.

Echo "This is $var";

Will take the value of $var, if any, and place it in the string.

---John Holmes...

> -----Original Message-----
> From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 22, 2002 11:53 PM
> To: [EMAIL PROTECTED]
> Cc: PHP General
> Subject: Re: [PHP] Help with mail...
> 
> Ok, that work. Why does the ' (quote) not make it work is it because
it's
> an
> array? Any thanks John that got it work.


--- End Message ---
--- Begin Message ---
If you need to bridge Perl and PHP, as suggested previously you 
could implement a web-service (SOAP or XML-RPC).  Alternatively,
you could write something Java bean and use PHP's Java support. 

Either of those will be costly from a performance point of view
CORBA will be the same (from what I have read HelloWorld in CORBA
is a painful 50 line program, one reason Java developed RMI to use 
instead).

In any case, I have to agree with folks who say mixing languages 
for the sake of gaining experince on a project is a bad idea.  There 
are definately places when introducing a new tech is a desireable 
thing, particuliarly when that tech offers some potentially large 
benefit to your project at a realtively small risk (i.e. at my 
company we recently re-wrote a JSP app to use struts+tiles moving 
to a templated set-up which will pay off as the app grows in size).

If you are only using Perl, to parse through a user's mail box, I 
would think you'd be better off to stick with PHP (the .cgi 
version),  using it as a shell script and parsing the STDIN with 
fopen("php://stdin","r") as Manuel suggested.  Split out your 
PHP logic into biz logic classes and then call your biz logic 
classes (include "bizlogic.php") in both your web portion and 
your email processing portion...

#!/usr/bin/php4
[?php
# replace [?php ] brackets with angles <?php >
# email script 
include "bizlogic.php";
$bl = new bizlogic();
$x = join('', file("php://stdin"));
switch ($argv[0]) {
'-process': $y = preg_match( ... , $x);
            $bl->processcommand($y, $x);
            break;
'-profit': $bl->profit($x);
           break;
}
...
?]

-GED

Northern.CA ===--
http://www.northern.ca 
Canada's Search Engine




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

I have a task to generate a new document number for a given range. This
document number is alphanumeric.

Here is the problem:

$lowrange1 = "900000";
$highrange1 = "HZZZZZ";

$currentno = "90CZZZ";

I expect that the next number in the series is:  $nextnum = "90D000";

Before using this next number in the series, I need to confirm that the
number falls within the given range.

So I do something like this:

if ((strval($nextnum) >= strval($lowrange1)) && (strval($nextnum) <=
strval($highrange1)))
{
    // we have a valid number in the range
}
else
{
    // not in the range
}

Now.. the problem is - PHP thinks that 90D000 is less than $lowrange1. I
individually tested them and $lowrange1 was consistently greater than the
number.

I put the strval function around each variable to ensure it was comparing
strings and not numbers for those variables that only contain numbers. This
seems to be a problem with the letter "D" and "E" for all positions within
the 6 character alphanumeric number, except for the last position.

ie. 900000D works - $lowrange1 is less than this number and $highrange1 is
greater than this number.

For all other positions where the letter "D" and "E" are generated:

ie. 9000D0, 900D00, 90D000, 9D0000 and 9000E0, 900E00, 90E000, 9E0000

Is there a known problem with this? Why it is only happening with the
letters "D" and "E"? If I have 900F00 - this works, and so on for the rest
of the letters of the alphabet.

Thanks,
Sam



--- End Message ---
--- Begin Message ---
Just quickly, forgot to mention:

I've tested this on 2 platforms:

Windows PHP 4.2.1
SCO Openserver 4.2.1

These two both don't work.

I just tested on SCO OpenUnix 4.2.1 - this one works!! Problem is, I need
this to work on SCO Openserver.

Thanks,
Sam

"Samantha Savvakis" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I have a task to generate a new document number for a given range. This
> document number is alphanumeric.
>
> Here is the problem:
>
> $lowrange1 = "900000";
> $highrange1 = "HZZZZZ";
>
> $currentno = "90CZZZ";
>
> I expect that the next number in the series is:  $nextnum = "90D000";
>
> Before using this next number in the series, I need to confirm that the
> number falls within the given range.
>
> So I do something like this:
>
> if ((strval($nextnum) >= strval($lowrange1)) && (strval($nextnum) <=
> strval($highrange1)))
> {
>     // we have a valid number in the range
> }
> else
> {
>     // not in the range
> }
>
> Now.. the problem is - PHP thinks that 90D000 is less than $lowrange1. I
> individually tested them and $lowrange1 was consistently greater than the
> number.
>
> I put the strval function around each variable to ensure it was comparing
> strings and not numbers for those variables that only contain numbers.
This
> seems to be a problem with the letter "D" and "E" for all positions within
> the 6 character alphanumeric number, except for the last position.
>
> ie. 900000D works - $lowrange1 is less than this number and $highrange1 is
> greater than this number.
>
> For all other positions where the letter "D" and "E" are generated:
>
> ie. 9000D0, 900D00, 90D000, 9D0000 and 9000E0, 900E00, 90E000, 9E0000
>
> Is there a known problem with this? Why it is only happening with the
> letters "D" and "E"? If I have 900F00 - this works, and so on for the rest
> of the letters of the alphabet.
>
> Thanks,
> Sam
>
>
>


--- End Message ---
--- Begin Message ---
Er..no, isn't working on OpenUnix.

90DZZZ - this should be 90E000 after the increment.

This isn't working on any platform using PHP 4.2.1


--- End Message ---
--- Begin Message ---
I am new to php and that the folowing error: Warning: mysql_num_rows():
supplied argument is not a valid MySQL result resource in
/home/tbonestu/public_html/smallimages.php

i dont know what i am doing wrong here is the code:

 @ $db = mysql_pconnect(connect info);

 mysql_select_db("images");
 $query = "select * from images where type =".$type."";
 $result = mysql_query($query);
 $num_results = mysql_num_rows($result);




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

Sunday, September 23, 2001, 3:25:02 PM, you wrote:
NV> I am new to php and that the folowing error: Warning: mysql_num_rows():
NV> supplied argument is not a valid MySQL result resource in
NV> /home/tbonestu/public_html/smallimages.php

NV> i dont know what i am doing wrong here is the code:

NV>  @ $db = mysql_pconnect(connect info);

NV>  mysql_select_db("images");
NV>  $query = "select * from images where type =".$type."";
NV>  $result = mysql_query($query);
NV>  $num_results = mysql_num_rows($result);


Do it this way

$query = "select * from images where type = '$type'";

or if you prefer
$query = "select * from images where type = '".$type."'";


PS check your comps date its a year out


-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
> I am new to php and that the folowing error: Warning:
mysql_num_rows():
> supplied argument is not a valid MySQL result resource in
> /home/tbonestu/public_html/smallimages.php
> 
> i dont know what i am doing wrong here is the code:
> 
>  @ $db = mysql_pconnect(connect info);
> 
>  mysql_select_db("images");
>  $query = "select * from images where type =".$type."";
>  $result = mysql_query($query);
>  $num_results = mysql_num_rows($result);

That generally means your query failed. Try to echo mysql_error() after
your query to see what the problem is. You probably need quotes around
$type or $type has no value.

---John Holmes...

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

>> I am new to php and that the folowing error: Warning:
mysql_num_rows():
>> supplied argument is not a valid MySQL result resource in 
>> /home/tbonestu/public_html/smallimages.php
>> 
>> i dont know what i am doing wrong here is the code:
>> 
>>  @ $db = mysql_pconnect(connect info);
>> 
>>  mysql_select_db("images");
>>  $query = "select * from images where type =".$type."";  $result = 
>> mysql_query($query);  $num_results = mysql_num_rows($result);

>That generally means your query failed. Try to echo mysql_error() after
your query to see what the problem is. You probably need quotes around $type
or $type has no value.

You also have too many quotes on the $query line, try echoing your $query
variable to see if it reads properly.

Mark


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

> I am new to php and that the folowing error: 
> Warning: mysql_num_rows(): supplied argument 
> is not a valid MySQL result resource in
> /home/tbonestu/public_html/smallimages.php
> 
> i dont know what i am doing wrong here is the code:
> 
>  @ $db = mysql_pconnect(connect info);

Along with the other suggestions to check your $query variable, you should
change this line to :

$db = @mysql_pconnect($whatever);

The @ goes in front of the function call, not the variable, if you want to
suppress any potential error messages generated by the function.


Cheers
Jon
--- End Message ---
--- Begin Message ---
Is there a way to create a layout file that can wrap around other pages with
data in them. I am currently using two includes (one at the start of the
page and one at the end) but was wondering if there is a better way to do
this.
Thanks


--- End Message ---
--- Begin Message ---
I generally do the same - have a header and footer file which create a three column 
table. The content then fits into the central column.

Other ways of doing this might be to use frames (though many disapprove of frames) or 
to use the iframe tag - the latter is something I only recently became aware of but 
can be quite useful and is not as messy as frames.

Michael Egan

-----Original Message-----
From: Patrick Lebon [mailto:[EMAIL PROTECTED]]
Sent: 23 September 2002 06:47
To: [EMAIL PROTECTED]
Subject: [PHP] Wrap content with a layout file


Is there a way to create a layout file that can wrap around other pages with
data in them. I am currently using two includes (one at the start of the
page and one at the end) but was wondering if there is a better way to do
this.
Thanks



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

--- End Message ---
--- Begin Message ---
Generally I like to have header and footer, but you should look at the
template engines out there (smarty for example) for some inspiration.

This for example, would work fine for a WIDE range of pages:

file.php?include=something:

<?
$include = $_GET['include'];
$file = "path/to/my/dir/{$include}.html";
if(!file_exists($file)) { $file = "path/to/my/dir/error.html"; }
?>
<html>
...
<? include($file); ?>
...
</html>


Some prefer one style others prefer another.


Justin


on 23/09/02 3:46 PM, Patrick Lebon ([EMAIL PROTECTED]) wrote:

> Is there a way to create a layout file that can wrap around other pages with
> data in them. I am currently using two includes (one at the start of the
> page and one at the end) but was wondering if there is a better way to do
> this.
> Thanks
> 
> 

--- End Message ---
--- Begin Message ---
Hi all,
 
I’m wondering why does a number 1 appears in the output after the
included text has been showed. I have a menu file for including and I
just put <?=include(“menu.inc”)?> but then the output shows:
 
Back to Index
1
 
and I don’t have that number in either my script nor my include file. If
I put:
 
<?
Include (“menu.inc”);
?>
 
it shows normally without the 1… Why is that?
 
Thanks,
 
Cesar Aracena <mailto:[EMAIL PROTECTED]> 
On Dial-Up
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621
 
--- End Message ---
--- Begin Message ---
<?=include(“menu.inc”)?> tells PHP to echo out the result of
include(“menu.inc”), which just happens to be a success code (1). The
second for simply includes the file without echoing out anything.

Chase
On Mon, 2002-09-23 at 02:45, César Aracena wrote:
> Hi all,
>  
> I’m wondering why does a number 1 appears in the output after the
> included text has been showed. I have a menu file for including and I
> just put <?=include(“menu.inc”)?> but then the output shows:
>  
> Back to Index
> 1
>  
> and I don’t have that number in either my script nor my include file. If
> I put:
>  
> <?
> Include (“menu.inc”);
> ?>
>  
> it shows normally without the 1… Why is that?
>  
> Thanks,
>  
> Cesar Aracena <mailto:[EMAIL PROTECTED]> 
> On Dial-Up
> CE / MCSE+I
> Neuquen, Argentina
> +54.299.6356688
> +54.299.4466621
>  
-- 
PGP Fingerprint = CE24 057D 1E88 A253 3196 89DB 9FF0 9EF0 2F70 8BE8

Attachment: signature.asc
Description: This is a digitally signed message part

--- End Message ---
--- Begin Message ---
Try to search for asp2php at google.com

[]'s

Ernani

"Nwakaji Eppie" <[EMAIL PROTECTED]> escreveu na mensagem
news:[EMAIL PROTECTED]...
> Does anyone know if there is a script that converts ASP to PHP??
>
> Thanks in advance
> Nwakaji
>
>


--- End Message ---
--- Begin Message ---
Hi people.
Is it possible to return multiple values in a function.
For instance, i want to do something like this:

function calculate_money($sum)
 {
 // some hanky panky calculations
return $type;
return $amount;
 }

Thanks!

Sincerely,
Faisal 

______________________________________

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

> Is it possible to return multiple values in a function.
> For instance, i want to do something like this:
> 
> function calculate_money($sum)
> {
>   // some hanky panky calculations
>   return $type;
>   return $amount;
> }

You have to return the values in an array, and use list() to break them up.
Try this:

function calculate_money($sum)
{
  // do stuff
  return array($type, $amount);
}

list($type, $amount) = calculate_money($whatever);

Cheers
Jon


--- End Message ---
--- Begin Message ---
I use a script which initially sends a friendly message to a browser, and
then goes about some lengthy processing. The browser is IE and I am aware of
the 256 byte issue.

The script worked nicely in php.4.1.1 but since installing 4.2.1, the flush
function doesn't do its job. However, it works if I ommit session_start() ?

Can anyone give me any pointers?

Thanks - Chris



--- End Message ---
--- Begin Message ---
make your checkboxes in the form an array with the index being the customer
id.

e.g.

in the form ...
foreach($customers as $cust)
{       echo("<tr>");
        ...
        echo("<input type='hidden' name='status[{$cust["id"]}]'
value='0'>");
        echo("<input type='checkbox' name='status[{$cust["id"]}]'");
        if ($cust["status"]) echo(" checked");
        echo(">");
        ...
        echo("</tr>");
}

and when processing
foreach($_POST["status"] as $custid=>status)
{       ... // update query for each customer
}

Tim
www.chessish.com

> -----Original Message-----
> From: Sascha Braun [mailto:[EMAIL PROTECTED]]
> Sent: 22 September 2002 18:43
> To: PHP Mailingliste
> Subject: Update undefined List Values in DB
> 
> 
> Hi,
> 
> I am creating a kind of Shopsystem right now.
> 
> One of the Funktions is going to be the possibiliy that the 
> page admin can set an customer status to 1 or 0
> via an listing of all customers.
> 
> My Problem is, that I have to change more than one value at a 
> time due to the Listing, where all
> customers are listed in one big list.
> 
> So I have to write multiple values in to the database as Update.
> 
> I don't have a clue how to do this, the only thing i could do is
> to make the change possible via an extrapage per customer,
> but I'm not able to change all values at a time.
> 
> Would be nice if somebody would give me a hint.
> 
> Please excuse my english
> 
> Sascha Braun
> 
--- End Message ---
--- Begin Message ---
Hello,

I'm working with Safe mode and I have a big trouble how the PHP is behaved. I have the 
web root and under them is directory, where my scripts are. This is my situation:

rwxr-xr-x www  www  /var/www/htdocs                     .... Web root
rwxr-xr-x www  www  /var/www/htdocs/test                .... PHP scripts
rw-r--r-- user user /var/www/htdocs/test/safe.php       .... script
        <?php
                readfile("noowner");
                readfile("owner");
                
        ?>
rw-r--r-- abc  abc  /var/www/htdocs/test/noowner.php    .... script
rw-r--r-- user user /var/www/htdocs/test/owener.php     .... script

And everything is working OK. That mean the "noowner" file is not included in script. 
BUT I need to change the owner of directory to user USER and after that change, the 
file "noowner" is included in spite of the user is different. 

New  situation:
rwxr-xr-x www  www  /var/www/htdocs                     .... Web root
rwxr-xr-x user user /var/www/htdocs/test                .... PHP scripts
rw-r--r-- user user /var/www/htdocs/test/safe.php       .... script
        <?php
                readfile("noowner");
                readfile("owner");
                
        ?>
rw-r--r-- abc  abc  /var/www/htdocs/test/noowner.php    .... script
rw-r--r-- user user /var/www/htdocs/test/owener.php     .... script

My configuration: Apache 2.0.40 and PHP 4.2.3, the same problem on Apache 2.0.39 and 
PHP 4.2.2.

Do you know, where the problem is?

Thanks,
Rudolf Wolf.

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

$a=1;
$b=&$a;
foreach(array(2,3) as $b);
echo "a=$a";

// Print a=3

Is it the behaviour expected
in a foreach loop?

JP


___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
--- End Message ---
--- Begin Message ---
It's good behavoiur because everytime even a reference gets a value,
also the target which it is pointing on should get the same value.

On Mon, 23 Sep 2002 12:57:56 +0200 (CEST), [EMAIL PROTECTED] (Jean-Pierre arneodo) 
wrote:

> Hi,
> 
> $a=1;
> $b=&$a;
> foreach(array(2,3) as $b);
> echo "a=$a";
> 
> // Print a=3
> 
> Is it the behaviour expected
> in a foreach loop?
> 
> JP
> 
> 
> ___________________________________________________________
> Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
> Yahoo! Mail : http://fr.mail.yahoo.com
--- End Message ---
--- Begin Message ---
I've never really payed attention to this before, but now I noticed that ==
is case-sensitive, how do I make it == with different "cases" ?

Håkan


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

> I've never really payed attention to this before, but now I noticed that ==
> is case-sensitive, how do I make it == with different "cases" ?

if(strtolower($a) == strtolower($b))
-- 
Krzysztof Dziekiewicz

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

> I've never really payed attention to this before, 
> but now I noticed that == is case-sensitive, how 
> do I make it == with different "cases" ?

Just force the case while you're comparing the two:

if (strtolower($a) == strtolower($b)) {
  echo "case-insensitive match";
} else {
  echo "no match";
}


Cheers
Jon

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Hawk [mailto:[EMAIL PROTECTED]]
> Sent: 23 September 2002 12:33
> To: [EMAIL PROTECTED]
> Subject: [PHP] == case-sensitive?
> 
> 
> I've never really payed attention to this before, but now I 
> noticed that ==
> is case-sensitive, how do I make it == with different "cases" ?

Use strcasecmp():

  strcasecmp($a, $b)  // returns 0 if strings match case-insensitive
                      // non-zero if not

This is slightly unfortunate in that the test you have to do is counter-intuitive:

  if (strcasecmp($a, $b)):
     // strings DON'T match
  else:
     // strings match case-insensitively
  endif;

Nonetheless, I'd prefer this over case-converting both strings and then comparing, as 
you're only making a single function call to do a comparison with in-line conversion, 
as opposed to two function calls for the conversions and then a comparison as well.  
(I guess I ought to benchmark that -- although it seems "obvious", sometimes the 
obvious isn't!)

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
I have two MySQL tables, groups and users:

        groups: group_id, group_name

        users: user_id, user_name, group_id, etc.

I would like to produce one table for each group which will list all the

members for that particular group. For example:

    Blue (group_id 1)

        Tom (group_id 1)

        Nancy (group_id 1)

        Jim (group_id 1)

    Red (group_id 2)

        Bob (group_id 1)

        Susan (group_id 1)

        James (group_id 1)

...

My question is, do I need to run 2 queries? The first to select all the

groups and the second to select all the users in each group based on the

group_id? How would I loop through to create a table for each group? 

Thanks in advance for any help.

Randy Rankin

--- End Message ---
--- Begin Message ---
Nope,

Do a select like so:

Select user_name, group_name from users,groups where
users.group_id=groups_id order by group_name;


Then do a php loop (you'll need to find the eact php commands, this is just
an example):

While (!$results->EOF)
{

If ($results[group_name]!="$old_groupname")
{
        $old_groupname=$results[group_name];
        print "<TR><TD>$old_groupname</td><td>&nbsp;</td></tr>";
}else
{
        print "<TR><TD>&nbsp;</td><TD>$results[user_name]</td></tr>";
}
$results=mysql_fetch_array($sql);
}

You'll obviously need to get exact mysql commands etc, and open and close
your table outside the loop, but this should be basically it.


Thanks

Mark


-----Original Message-----
From: Rankin, Randy [mailto:[EMAIL PROTECTED]] 
Sent: 23 September 2002 13:37
To: '[EMAIL PROTECTED]'
Subject: [PHP] Confused


I have two MySQL tables, groups and users:

        groups: group_id, group_name

        users: user_id, user_name, group_id, etc.

I would like to produce one table for each group which will list all the

members for that particular group. For example:

    Blue (group_id 1)

        Tom (group_id 1)

        Nancy (group_id 1)

        Jim (group_id 1)

    Red (group_id 2)

        Bob (group_id 1)

        Susan (group_id 1)

        James (group_id 1)

...

My question is, do I need to run 2 queries? The first to select all the

groups and the second to select all the users in each group based on the

group_id? How would I loop through to create a table for each group? 

Thanks in advance for any help.

Randy Rankin

--- End Message ---
--- Begin Message ---
Greetings, all,

I've been using PHP for a couple of years now and only
recently (since upgrading to RH7.3) began to
experience an odd problem.  When navigating around my
site or when I run HT://Dig across it the links are
suddenly being rewritten back as
http://my.dom.com/some_page?PHPSESSID=the_id_string. 
I haven't
changed my coding between releases so evidently
whatever I've been doing with session variables all
along is suddenly behaving differently between
releases.

Having the session ID suddenly exposed in the URL
looks odd and prevents HT://Dig from indexing
properly.  What have I done to make this suddenly show
up and how can I get rid of it?

Thanks much in advance and best regards to all!
Bill

=====
Bill Farrell
Multivalue and *nix Support Specialist

Phone: (828) 667-2245
Fax:   (928) 563-5189
Web:   http://www.jwfarrell.com

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
--- End Message ---
--- Begin Message ---
Hi Bill,

> I've been using PHP for a couple of years now and only
> recently (since upgrading to RH7.3) began to
> experience an odd problem.  When navigating around my
> site or when I run HT://Dig across it the links are
> suddenly being rewritten back as
> http://my.dom.com/some_page?PHPSESSID=the_id_string. 
> I haven't changed my coding between releases so evidently
> whatever I've been doing with session variables all
> along is suddenly behaving differently between
> releases.

Your new installation looks like it has the enable_trans_sid option turned
on: this option governs whether PHP will transparently rewrite links for
users without cookies - htdig is one of these presumably ;-)

You'll find that your <form>s have a new <input type="hidden"> field as
well, containing the session ID.

It can be turned off in php.ini, but I think this might break sessions for
non-cookie-accepting users (not sure).


Cheers
Jon


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



I hope this is the right place to pose my question, so here goes: -



I have a javascript function called calcMonth() and given a number it will
return a date i.e. month = calcMonth( 57 )   -  month will be 'sept 2002'



The problem I`m having is at the beginning of my PHP file I`m calling this
calcMonth() then doing a load of php stuff and then trying to use the
javascript month variable, but to no avail: -



print "<td><input type=text class=claimreadonly readonly name=POST_monthdisp
value=javascript:month; size=10 tabindex=99></td>";



The result is, the browser displays the words 'javascript:month;' - not a
month number



I`ve looked everywhere for an answer from persistent javascript data to
using framesets to hold the variable but to no avail.



I know its quite a bit of javascript, but its mixed in  with PHP too so I
thought it`d be the right place.



Anyways, I hope someone can provide the answer to my problem.



Thanks in advance,

Tom



--- End Message ---
--- Begin Message ---
Tom,
JavaScript is a client side language, while PHP is server side.

This means that the PHP is parsed and evaluated before it ever reaches the 
surfers browser.  And since the JavaScript variable will not be available 
until it is created by the browser, there is no way to interact with it.


Peter


At 02:08 PM 9/23/2002 +0100, Tom wrote:
>Hi all,
>
>
>
>I hope this is the right place to pose my question, so here goes: -
>
>
>
>I have a javascript function called calcMonth() and given a number it will
>return a date i.e. month = calcMonth( 57 )   -  month will be 'sept 2002'
>
>
>
>The problem I`m having is at the beginning of my PHP file I`m calling this
>calcMonth() then doing a load of php stuff and then trying to use the
>javascript month variable, but to no avail: -
>
>
>
>print "<td><input type=text class=claimreadonly readonly name=POST_monthdisp
>value=javascript:month; size=10 tabindex=99></td>";
>
>
>
>The result is, the browser displays the words 'javascript:month;' - not a
>month number
>
>
>
>I`ve looked everywhere for an answer from persistent javascript data to
>using framesets to hold the variable but to no avail.
>
>
>
>I know its quite a bit of javascript, but its mixed in  with PHP too so I
>thought it`d be the right place.
>
>
>
>Anyways, I hope someone can provide the answer to my problem.
>
>
>
>Thanks in advance,
>
>Tom
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

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

--- End Message ---

Reply via email to