Re: [PHP] magic quotes

2002-12-04 Thread Philip Olson

magic_quotes_gpc is simple, it essentially runs
addslashes on all GET, POST and COOKIE data.

That's it.

  http://www.php.net/ref.info#ini.magic-quotes-gpc
  http://www.php.net/addslashes
  http://www.php.net/variables.external

Not sure about your problem, maybe someone else can
help.

Regards,
Philip


On Wed, 4 Dec 2002, John Taylor-Johnston wrote:

> What are magic quotes? Will this help me?
> 
> http://news.php.net/article.php?group=php.general&article=126934
> 
> How is this different from stripslashes.
> 
> I have RTF doc :)
> 
> http://www.php.net/manual/en/function.get-magic-quotes-gpc.php
> 
> Be gentil ::p
> 
> --
> John Taylor-Johnston
> -
> "If it's not open-source, it's Murphy's Law."
> 
>- Université de Sherbrooke:
>   http://compcanlit.ca/
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] ini function like ini_set and ini_alter

2002-12-04 Thread Philip Olson

Reread the docs here (the table):

  http://www.php.net/ini_set

You cannot set this directive at runtime.  Using .htaccess
is as close as you'll get to that.  I see no reason why
using auto_prepend_file here would be better than include()
as this is exactly what include() is for.

Regards,
Philip


On 4 Dec 2002, Franco Pozzer wrote:

> Thanks for all.
> 
> My end it is Apache 1.3.27 and PHP 4.3.2 in Win32 system NT 4.0.
> 
> I have the php.ini auto_prepend_file  like this:
> auto_prepend_file="C:\OPENFEDRA\Apache\htdocs\fedra\sv\cfg\" 
> 
> All work fine with this configuration of the php.ini.
> 
> For same reason I must to do not configure php.ini and the directives
> auto_prepend_file must be null like auto_prepend_file =.
> 
> I have discovered ini_alter function but I do not be able to work in my
> application.
> 
> My script it is like:
>  $path="C:\\OPENFEDRA\\Apache\\htdocs\\fedra\\sv\\cfg\\";
> 
> echo"$path";
> 
> if(ini_alter('auto_prepend_file', $path.'systemVariables.php'))
>  echo "ini_alter success";
> else
>  echo "ini_alter failed";
> 
> but do not work.
> 
> If I change the ini_alter with include() it work all fine but I do not
> want to use include or require function.
> 
> have sameone an idea about this code do not work??
> 
> Thanks for all and if it is possible reply to me also to e-mail follow.
> 
> [EMAIL PROTECTED]
> www.infocamere.it
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] PHP 2.4.3 and Apache 2.0.x

2002-12-04 Thread Philip Olson

Read the docs:

  http://www.php.net/install.apache2.php

Apache 2 is EXPERIMENTAL in PHP right now, it may
or may not work.  But, the following combination
is known to work:

  PHP 4.2.3 along with Apache 2.0.39

But Apache 1.3.x is recommended and considered stable and
will work with any PHP version.

Regards,
Philip


On Wed, 4 Dec 2002, Adam Williams wrote:

> If you mean PHP 4.2.3, it'll work with apache 2.0, but not that great.
> I'm also using PHP 4.3.0-rc2 with Apache 2.0 and its not any better.
> 
>   Adam
> 
> On Wed, 4 Dec 2002, Vicente Valero wrote:
> 
> > Hello,
> >
> > PHP 2.4.3 can work with Apache 2.0.x or I need Apache 1.3.x?
> 
> 
> -- 
> 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] trouble with update from php 3 to php 4.2.3

2002-12-04 Thread Philip Olson

If you want to do relative includes, you must have a . in
your include_path.  Maybe this is what you are meaning to
do.  Please reread this:

  http://www.php.net/configuration.directives.php#ini.include-path

And if you still have problems after adjusting it and restarting
the web server, tell us your include_path definition and make
sure it's the same as reported in phpinfo().

Regards,
Philip

On Wed, 4 Dec 2002, Omar wrote:

> I updated php from version 3 to 4.2.3 on a win NT 4 server (with iss 4).
> Everything went ok, but the include() function.
> I have problems when including files.
> I tried to specify a directory in the php.ini file but it still didn't work.
> This is how i have the include line:
> include ('file.inc');
> 
> I copied the file to the folder where my php file is, to the directory where
> originally was (x:\path\includes) and it doesn't work.
> I really need some help.
> Thanx.
> 
> 
> 
> 
> -- 
> 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] fopen over a network

2002-12-04 Thread Philip Olson

Please reread the documentation found here:

  http://www.php.net/header

It has a pdf file as an example, modify according
to your needs.

Regards,
Philip


On Wed, 4 Dec 2002, Elkan wrote:

> Couldn't you set the Mime-Type on the server for the correct extenstion?
> 
> Leif K-Brooks wrote:
> 
> > Link them to a page like this to download the file:
> >
> >  > header("Content-type: application/octet-stream");
> > //Code to display file
> > ?>
> >
> > Dara Dowd wrote:
> >
> > >Hello,
> > >I'd like a user to be able download a file from a file server on my LAN.
> > >
> > >Using  works ok, but this simply 
>displays the file in the browser and I want to force the download dialog box to 
>appear.
> > >
> > >
> > >So now i have , and i want to do something 
>like
> > >fopen("file://server/directory/filename",rb") but i just get an invalid argument 
>warning.
> > >Am i on the right track?Is there a way around this?
> > >
> > >Cheers,
> > >Dara
> > >
> > >
> > >
> > >
> > >
> >
> > --
> > 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] Passing variables from script to script

2002-12-11 Thread Philip Olson
On Tue, 10 Dec 2002, Stefan Hoelzner wrote:

> Hi folks,
> 
> surely this question has already been answered many times before in
> this ng, but nevertheless: I want to pass variables from one .php to
> another .php script. But I do not want to use either the
> http://localhost/target.php?var1=test&var2=test2 nor the POST method.
> I would like to pass over general variables like usernames and
> passwords for several MySQL-connects;  obviously it is not a good way
> to pass these vars via the mentioned ways.
> 
> What else does PHP offer? Are there any other methods? Can I define
> these vars as some kind of "global variables" in any ini-file?

Use includes.  http://www.php.net/include

dbinfo.inc


showstuff.php


Ideally this include will be outside the document root.  If 
not, make sure it's not viewable or use a php extension such 
as .php  See also the include_path php directive.

Regards,
Philip


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




Re: [PHP] GD installation - Simple Question

2002-12-11 Thread Philip Olson

To use the bundled gd just do: --enable-gd

Note that 4.3.0 is the first distro that includes a 
bundled GD.  Also note that as of 4.3.0 just doing 
--with-gd will also use the bundled GD.  Before this, 
--with-gd (no directory specified) would look for a 
local copy.  That seems odd yes but theory is it
means more people will use the preferred bundled GD
now. To use a non-bundled, you must specify the path 
so: --with-gd=/path/to/gd/dir

Note: It's strongly recommended to use the bundled GD.

Regards,
Philip

p.s. 4.3.0-RC3 came out today! :)


On Wed, 11 Dec 2002, Sean Burlington wrote:

> [EMAIL PROTECTED] wrote:
> > Hello list,
> > 
> > simple question:
> > 
> > I´ve heard that it is possible to compile php with dg-support on two ways
> > 1) first way: Distribution dependant with the gd-files and libraries, eg. gd.c, 
>gd.lo, gd.o 
> > coming with the distribution of the compiled php-4.x-tarball
> > compiled the follwing way:
> > 
> > ./configure .. --with-gd 
> > 
> > 
> > 2) second way: You can compile the newest Distribution from GD, eg. gd-2.0.8
> > 
> > compiling gd-2.0.8 this way
> > ./configure --prefix=/usr/local/gd ...
> > eg. under  /usr/local/gd
> > 
> > and the compile php-4.x this way
> > ./configure  --with-gd=/usr/local 
> > 
> > 
>  > Did I got that right ?
> 
> almost
> 
> I think that the value you use for 'prefix=' on gd should be the same as 
> the value for 'with-gd='
> 
> and its probably best to install gd in /usr/local so that the libraries 
> are in an already known location.
> 
> like this
> 
> ./configure --prefix=/usr/local
>   eg. under  /usr/local
> 
> and the compile php-4.x this way
> ./configure  --with-gd=/usr/local
> 
> if you do this - be aware that you will have two versions of gd 
> installed - this shouldn't cause any problems but don't forget you have 
> two versions - and if you install more software make sure it finds the 
> right version.
> 
> - you can always remove the ditro version - but eg rpm may complain 
> about dependency problems as it won't know about your /usr/local version.
> 
> -- 
> 
> Sean
> 
> 
> -- 
> 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] Execute a cgi inside of php?

2002-12-11 Thread Philip Olson

The error you get does not have to do with that note,
but rather that code of yours has many other issues 
such as:

  a) The syntax is incorrect

print "a b " c " d";   // bad
print "a b \" c \" d"; // good
print "a b ' c ' d";   // good
print 'a b " c " d';   // good
...
http://www.php.net/types.string

  b) You are attempting to mix SSI into PHP

You can't do that, just like how one can't
write PERL or ASP code in PHP.

Some options:

  a) Using virtual()
 
virtual("../cgi-bin/include/horoscopes.cgi");

  b) Go through HTTP

$url = 'http://www.example.com/foo/horoscopes.cgi';
echo implode('', file($url));

  c) Rewrite horoscopes.cgi as PHP

This is the ideal option, consider doing this
in the future.

That manual note you referred to has to do with code
such as (http == remote file):

  include 'http://www.example.com/foo.php';

Which would include the output of that url into the
webpage.  This is unrelated and remember that parse errors
are always due to syntax problems.

Regards,
Philip Olson


On Wed, 11 Dec 2002, Richard Creech wrote:

> 
> Hello List,
> Is there a way to execute a cgi inside of php? This is what a customer wants to do:
> 
> 
> include("");
> 
> but get an error message:
> 
> Parse error: parse error, unexpected '.' in 
>D:\Inetpub\townforum\wwwroot\orgs\header.php on line 3
> 
> 
> The manual says it won't work:
> http://www.php.net/manual/en/function.include.php
> "Warning 
> Windows versions of PHP prior to PHP 4.3 do not support accessing remote files via 
>this function, even if allow_url_fopen is enabled." 
> 
> The mail archives didn't shed any light on this question.
> 
> 
> What alternatives might work?
> 
> 
> Regards,
> 
> Richard Creech
> [EMAIL PROTECTED]
> 250.744.3350 Pacific Time
> Free and retail php resources for developers
> http://www.dreamriver.com
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 




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




Re: [PHP] Using fopen() to open a php file with variables.

2002-12-11 Thread Philip Olson

Why don't you just use include?

 $month = 12;
 $year  = 2002;

 // This include has access to the above variables
 include 'make_calendar.php3';

Include it wherever you intended to print $caledar_html.
It doesn't exist in your code because the url is seen as 
part of the filename.

Regards,
Philip Olson


On Wed, 11 Dec 2002, Jay (PHP List) wrote:

> Okay, I need to retrieve the output of a php file with variables being
> passed to it.  Example:
> 
> $calendar_file = "make_calendar.php3?month=$month&year=$year";
> $fp = $fp = fopen("$calendar_file", "r");
> while (!feof ($fp)) {
>   $buffer = fgets($fp, 4096);
>   $calendar_html .= $buffer;
> }
> fclose($fp);
> 
> It gives me an error that the file doesn't exist, but it does.  Any
> suggestions?
> 
> Jay Douglas
> Systems Consultant
> Fort Collins, CO
> 
> 


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




Re: [PHP] Delete array element

2002-12-11 Thread Philip Olson

Remove the {braces}, those are only used when
inside "a {$strin['g']}".  Also, be sure to
'quote' your array indices.

  unset($arr['foo'][$bar]);

Regards,
Philip Olson



On Wed, 11 Dec 2002, Richard Baskett wrote:

> Ok I feel a little sheepish after that answer :)  Still not working though
> due to my variable.. help!
> 
> unset({$_SESSION[map][mapText][$_POST[Email]]});
> 
> Im getting errors on this because I havent figured out how to get it to
> understand that variable :(
> 
> Rick
> 
> "If I accept you as you are, I will make you worse; however, if I treat you
> as though you are what you are capable of becoming, I help you become that."
> - Johann Wolfgang von Goethe
> 
> > From: "John W. Holmes" <[EMAIL PROTECTED]>
> > Organization: U.S. Army
> > Reply-To: <[EMAIL PROTECTED]>
> > Date: Wed, 11 Dec 2002 21:37:18 -0500
> > To: "'Richard Baskett'" <[EMAIL PROTECTED]>, "'PHP General'"
> > <[EMAIL PROTECTED]>
> > Subject: RE: [PHP] Delete array element
> > 
> >> How can I delete a key and it's value from an array?
> >> 
> >> for example:
> >> 
> >> $test = array(0=>'yes', 2=>'no', 5=>'maybe', 7=>'so');
> >> 
> >> And I wanted to delete the second key "2" so I could end up with an
> > array
> >> like so:
> >> 
> >> $test = array(0=>'yes', 5=>'maybe', 7=>'so');
> > 
> > unset($test[2]);
> > 
> > ---John W. Holmes...
> > 
> > PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> > today. http://www.phparch.com/
> > 
> > 
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> > 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] GD installation - Simple Question

2002-12-12 Thread Philip Olson

No, GD is only bundled as of PHP 4.3.0.

Regards,
Philip


On Thu, 12 Dec 2002 [EMAIL PROTECTED] wrote:

> Hello Phillip, hello Sean,
> 
> thank you very much, for answering the question of --with-gd  -  compiling.
> 
> I am not using 4.3 . I did it with php-4.2.3
> 
> Did I got it right - to use the bundled-gd I have to use the
> compiling-flag:
> --enable-gd
> ??
> 
> But when I run ./configure --help there isn´t shown any flag --enable-gd
> just --enable-gd-native-ttf to use GD: Enable TrueType string function.
> 
> Any hints???
> 
> Oliver Etzel
> 
> 
> 
> 
> To use the bundled gd just do: --enable-gd
> 
> Note that 4.3.0 is the first distro that includes a
> bundled GD.  Also note that as of 4.3.0 just doing
> --with-gd will also use the bundled GD.  Before this,
> --with-gd (no directory specified) would look for a
> local copy.  That seems odd yes but theory is it
> means more people will use the preferred bundled GD
> now. To use a non-bundled, you must specify the path
> so: --with-gd=/path/to/gd/dir
> 
> Note: It's strongly recommended to use the bundled GD.
> 
> Regards,
> Philip
> 
> p.s. 4.3.0-RC3 came out today! :)
> 
> 
> On Wed, 11 Dec 2002, Sean Burlington wrote:
> 
> > [EMAIL PROTECTED] wrote:
> > > Hello list,
> > >
> > > simple question:
> > >
> > > I´ve heard that it is possible to compile php with dg-support on two
> ways
> > > 1) first way: Distribution dependant with the gd-files and libraries,
> eg. gd.c, gd.lo, gd.o
> > > coming with the distribution of the compiled php-4.x-tarball
> > > compiled the follwing way:
> > >
> > > ./configure .. --with-gd 
> > >
> > >
> > > 2) second way: You can compile the newest Distribution from GD, eg.
> gd-2.0.8
> > >
> > > compiling gd-2.0.8 this way
> > > ./configure --prefix=/usr/local/gd ...
> > > eg. under  /usr/local/gd
> > >
> > > and the compile php-4.x this way
> > > ./configure  --with-gd=/usr/local 
> > >
> > >
> >  > Did I got that right ?
> >
> > almost
> >
> > I think that the value you use for 'prefix=' on gd should be the same as
> > the value for 'with-gd='
> >
> > and its probably best to install gd in /usr/local so that the libraries
> > are in an already known location.
> >
> > like this
> >
> > ./configure --prefix=/usr/local
> >   eg. under  /usr/local
> >
> > and the compile php-4.x this way
> > ./configure  --with-gd=/usr/local
> >
> > if you do this - be aware that you will have two versions of gd
> > installed - this shouldn't cause any problems but don't forget you have
> > two versions - and if you install more software make sure it finds the
> > right version.
> >
> > - you can always remove the ditro version - but eg rpm may complain
> > about dependency problems as it won't know about your /usr/local version.
> >
> > --
> >
> > Sean
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] MySQL error

2002-12-12 Thread Philip Olson

You need to do some error handling, as in:

>   $mysql_result = mysql_query($query, $mysql_link);
> 
> // get each row
> 
> --> line 36   while($row = mysql_fetch_row($mysql_result))
> 

Make sure $mysql_result is a valid resource as PHP
is telling you it's not.  Here's one way:

if (!$mysql_result) {
echo "DB Error ($query) : " . mysql_error();
exit;
}

while ($row = mysql_fetch_row($mysql_result)) {

}

See?  We made sure $mysql_result isn't false as the
function mysql_query returns false on failure. If
it is false, we print some useful info out to
debug it.  In production, you most likely won't want
to print it out but anyway...

For a more complete example, see:

  http://www.php.net/mysql_fetch_assoc

Btw, being that there is a function named mysql_result
I wouldn't create a variable by that name, kinda confusing.

Regards,
Philip Olson

p.s. mysql_error is your friend.




> {
> 
> //get columns
>
>   $id = $row[0];
>   $ynimi = $row[1];
>   $ylahi = $row[2];
>   $ypostios = $row[3];
>   $ypostitmp = $row[11];
> 
>   print("\n");   
>   print("\n");
>  
>   print("$ynimi, $ylahi, $ypostios
> $ypostitmp\n");
>   print(" HREF=\"tarkenna.php3?id=$id\">MUOKKAA> -  HREF=\"poista.php3?id=$id\">POISTA>");
> 
>   print("\n");
>   print("\n");
> 
> }
> 
> // disconnect 
> mysql_close($mysql_link);
> ?>
> 
> when run, i'll following error messages:
> 
> Warning: mysql_fetch_row(): supplied argument is not a valid MySQL
> result resource in /www/domains/lammidb.phnet.fi/public_html/kaikki.php3
> on line 36
> 
> 
> 
> -- 
> 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] Don't get variable to be passed to the page on submit

2002-12-13 Thread Philip Olson

Read this:

  http://www.php.net/variables.external

Pay special attention to the parts about the PHP 
directive register_globals.

If on, both $_GET['nafn'] and $nafn will exist.  If
off, $nafn will not exist.  As of PHP 4.2.0, the default
for this in php.ini went from on to off.

This applies to all variables, even web server variables
such as PHP_SELF so you'd use: $_SERVER['PHP_SELF'], etc.

Regards,
Philip Olson

P.s. So you want your query to look more like this:

  $sql = INSERT INTO $db_imgCat (catName, subCat) 
 VALUES  ('{$_GET['nafn']}', 0)";

P.s.s. Consider validating nafn first, users are evil.
P.s.s.s. Use $_SESSION instead of session_register


On Fri, 13 Dec 2002, [iso-8859-1] Davíð Örn Jóhannsson wrote:

> I have this code whitch I have been staring at for hours and I just
> can’t figure out what is going on...
>  
> it is about as simple as it gets I just need to pass a variable from
> this page to it self, and that would be tha variable $nafn
>  
> I have this included code included into another page that is why I use
> the aAction and sAction variables in the from action
> so the script knows where to go after submiting. I have done similar
> things on this site I’m working on an that works but this
> i just can’t get to work.
>  
> It is prob. just somthing silly and wery eazy but I could use some
> assistance to finde out what.
>  
> Regards, David
>  
>   
> if(!isset($submit)){
> session_register("nafn");
> ?>
> "
> method="post" enctype="text/plain" name="form">
>  
>   
>  
>   Nafn yfirflokks:
>   
> 
>   
>  
>   
> 
>   
> 
>  }
> else{
> print($test);
> print($nafn);
> $newQuery = "INSERT INTO $db_imgCat (catName, subCat) VALUES
> ('$nafn', 0)";
> if(mysql_query($newQuery, $db) or die(mysql_error())){
> print("Flokkur vistaður");
> }
> else{
> print("fail");
> }
> 
> }
> ?>
>  
>  
> 


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




RE: [PHP] Array

2002-12-16 Thread Philip Olson

I'm not sure what is meant in this thread but arrays
are pretty simple.  PHP allows both numerical and
associative arrays (although in all reality they all 
are associative) but anyway:

 $arr1 = array('a','b','c', 42 => 'yep');
 print $arr1[0];  // a
 print $arr1[1];  // b
 print $arr1[2];  // c
 print $arr1[42]; // yep

 $arr1[] = 'd';
 print $arr1[43]; // d


 $arr2 = array('a' => 'apple', 'blah');
 print $arr2['a']; // apple
 print $arr2[0];   // blah

Anyway the best way to see what values an array
actually has is with print_r() or var_dump()

 print_r($arr2);

That code quoted from "PHP Bible" has many issues,
it isn't generic at all.  Please ignore it or at
least keep in mind the context of it.  A more
generic form of it:

 function print_keys_and_values($arr) {
 foreach ($arr as $key => $value) {
 print "Key: $key - Value: $value\n";
 }
 }

Please read the following manual entries on arrays:

 http://www.php.net/types.array
 http://www.php.net/foreach

Play around with them for awhile and they'll
eventually make sense.  Regarding the original
question of this thread, see print_r() as I
blame a typo or something... or maybe it's a
variable scope issue.  Your example looks fine.

Regards,
Philip Olson

P.s: Essentially
   numerical   == numbered keys
   associative == worded keys


On Mon, 16 Dec 2002, Andy Turegano wrote:

> I see. Well, in that case I don't really know what to do. Sorry.
> 
> 
> On Tue, 17 Dec 2002, Quentin Bennett wrote:
> 
> > Hi,
> >
> > No I don't think that is right.
> >
> > $monthschedule["Jun"] is not what is being looked for, but 
>$monthschedule[something]="Jun";
> >
> > Try doing a loop to see what is in the array.
> >
> > Example, from PHP Bible,
> >
> > function print_keys_and_values_each($arr)
> > {
> >reset($arr);
> >while ($cell = each($arr))
> >{
> >   $c = $cell['value'];
> >   $k = $cell['key'];
> >   print ("Key: $k; Value: $c");
> >}
> > }
> >
> >
> > Quentin
> >
> > -Original Message-
> > From: Andy Turegano [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, 17 December 2002 10:25 a.m.
> > To: Mako Shark
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Array
> >
> >
> > What you have to do, at least I think, is you have to type:
> > $r = $monthschedule["Jun"];
> >
> > That is what I think you have to do. The other way you did it was when you
> > have a value-only array.
> >
> >
> > On Mon, 16 Dec 2002, Mako Shark wrote:
> >
> > > I have an array I set up like this:
> > >
> > > $monthschedule = array(1 => "Jan", 2 => "Feb", 3 =>
> > > "Mar", 6 => "Jun");
> > >
> > > When I try to access them, doing this:
> > > $r = $monthschedule[6];
> > >
> > > nothing comes up ($r is blank). Any thoughts? There
> > > are missing elements (4,5,7-12) in $monthschedule.
> > >
> > > __
> > > Do you Yahoo!?
> > > Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> > > http://mailplus.yahoo.com
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > The information contained in this email is privileged and confidential and
> > intended for the addressee only. If you are not the intended recipient, you
> > are asked to respect that confidentiality and not disclose, copy or make use
> > of its contents. If received in error you are asked to destroy this email
> > and contact the sender immediately. Your assistance is appreciated.
> >
> > --
> > 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] mysql_num_rows

2002-12-17 Thread Philip Olson

> Would someone be kind enough to explain why I'm not getting the correct
> result from the following query.  If I select a valid member no. and name,
> the following query should return 1 row.  This is not the case, however.  It
> returns zero rows.
> 
> $sql = "SELECT  * FROM users WHERE member_no = '$member_no' and
> name = ' $name' ";

Because ' $name' != '$name' so zero rows are returned. So
remove the leading space from your query and you'll get
one row..

> $result = mysql_query($sql) or die ("Cannot verify the member");
> $rows = mysql_num_rows($result);
> echo "rows = $rows";
> 
> Furthermore when trying the following query where the table "users" contains
> 13 rows, the query returns only 12 rows.
> 
> $sql = "SELECT  * FROM users";
> $result = mysql_query($sql) or die ("Cannot verify the member");
> $rows = mysql_num_rows($result);
> echo "rows = $rows";

Because there are 12 rows, not 13 ;)  Check again or simply 
test it:

$sql = "SELECT * FROM users";
if (!$result = mysql_query($sql)) {
echo "Could not run query ($sql) " . mysql_error();
exit;
}

$count = mysql_num_rows($result);

while ($row = mysql_fetch_assoc($result)) {
$rows[] = $row;
}

print "";
print "Returned: " . count($rows) . " and num_rows: $count\n";
print_r($rows);

> Conclusion: mysql_num_rows seems to be returning one less row 
> than exists.  Is this correct?

Nope.



Regards,
Philip Olson


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




Re: [PHP] list and (array) get_val

2002-12-18 Thread Philip Olson

Have another look here:

  http://www.php.net/list

Note that the list construct only works
on numerical arrays and assumes 0-n. You
may want to use import_request_variables()
or extract() though.

Regards,
Philip Olson


On Wed, 18 Dec 2002, Ns_Andy wrote:

> a.php
> 
>  list($a) = $_GET;
> print $a;
> ?>
> 
> and I typed a.php?b=c
> 
> I expected c would be printed, What the problems have I made?
> -- 
> Regards,
> Ns_Andy, [EMAIL PROTECTED]
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] easy spliting

2002-12-18 Thread Philip Olson

You may want to provide more information like why
is this string being split at these seemingly
random points?  Maybe there is a common separator
or could be? But anyway it sounds like you want 
substr().

  http://www.php.net/substr


Regards,
Philip Olson



On Wed, 18 Dec 2002, Alex Ciurea wrote:

> Hi,
> 
> I know it is easy but I can't figure how I should do
> 
> I want to split a string from position  1 to 9, from 10 to 36, from 37 to 54 and so 
>on...
> 
> how can I do this?
> 
> 
> is there a function who does this?
> 
> 
> Regards,
> 
> Alx
> 
> 
> 


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




Re: [PHP] Re: mysql_num_rows

2002-12-18 Thread Philip Olson

First, there is no reason to do mycounter like this 
when mysql_num_rows() will work perfectly.  It's not
based on any certain column numbers or primary keys.
Although if you're suggesting this method to simply
print 0-n in the loop (as users may want to know the
row number of output not any id number) then that's
good altough it's not really a counter in this case.

Second, we assume this person wants a count for
informational purposes, to go along with the
data in which case mysql_num_rows() is your best
bet.  It means having a count before the data is
printed/used.  And checking the number or rows
returned before fetching is a form of error handling
as well as if it equals 0 than there is no data to
fetch.  But if one ONLY wants a number of rows count, 
doing SELECT count(*)... works great as suggested 
below.


Regards,
Philip Olson


On Wed, 18 Dec 2002, liljim wrote:

> Hi John,
> 
> "John Taylor-Johnston"  wrote in message:
> > I use $mycounter, not saying it is pretty. But if you have a whole bunch
> of stuff deleted, your last id might be worth a lot more than the actual
> number of rows.
> >
> > $myconnection = mysql_connect($server,$user,$pass);
> > mysql_select_db($db,$myconnection);
> >
> > $news = mysql_query('select * from '.$table.' where '.$where.' order by id
> asc');
> >  $mycounter = 0;
> >  while ($mydata = mysql_fetch_object($news))
> >  {
> >   $mycounter++;
> >  }
> 
> Have you ever considered just doing a count()?
> 
> $count = @mysql_query("select count(*) from [table(s)] where [criteria
> [group by something]]");
> $total = mysql_result($count, 0);
> 
> That will return the number of rows in your table(s). It's also much quicker
> and less resource intensive, particularly with large datasets. :)
> 
> James
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] Re: mysql_num_rows

2002-12-18 Thread Philip Olson

And now mysql4 allows doing this another way, I *assume*
this new way is slightly faster then the additional
count() although I haven't tested it and wonder if it
affects mysql_num_rows()...

  See: SQL_CALC_FOUND_ROWS()

  http://www.mysql.com/doc/en/Miscellaneous_functions.html

Regards,
Philip Olson


On Wed, 18 Dec 2002, liljim wrote:

> I would also tend to do a count(*) as well as the main query if I intend to
> use pagination (with the help of LIMIT in the main query).
> 
> Suppose, for example, you're limiting to 30 news posts per page, and from
> calculations there are only 2 pages that fall into the criteria, then trying
> to bring the result set back on page 3 when it doesn't "exist" will result
> in a warning. Also, you'll want to know how many pages of the news post
> there are...
> 
> Brief Example (assuming $page has already been validated as an integer):
> 
> $num = 30; // per page
> $total = 49; // result from count(*)
> $total_pages = ceil($total/$num);
> if($page > $total_pages)
> {
> $page = $total_pages;
> }
> 
> // Main query.
> // "select [whatever] from [table(s)] where [criteria] [whateverelse] limit
> " . (($page*$num)-$num) . ",$num;
> 
> James
> 
> "Philip Olson" <[EMAIL PROTECTED]> wrote in message
> Pine.BSF.4.10.10212181637090.4483-10@localhost">news:Pine.BSF.4.10.10212181637090.4483-10@localhost...
> >
> > First, there is no reason to do mycounter like this
> > when mysql_num_rows() will work perfectly.  It's not
> > based on any certain column numbers or primary keys.
> > Although if you're suggesting this method to simply
> > print 0-n in the loop (as users may want to know the
> > row number of output not any id number) then that's
> > good altough it's not really a counter in this case.
> >
> > Second, we assume this person wants a count for
> > informational purposes, to go along with the
> > data in which case mysql_num_rows() is your best
> > bet.  It means having a count before the data is
> > printed/used.  And checking the number or rows
> > returned before fetching is a form of error handling
> > as well as if it equals 0 than there is no data to
> > fetch.  But if one ONLY wants a number of rows count,
> > doing SELECT count(*)... works great as suggested
> > below.
> >
> >
> > Regards,
> > Philip Olson
> >
> >
> > On Wed, 18 Dec 2002, liljim wrote:
> >
> > > Hi John,
> > >
> > > "John Taylor-Johnston"  wrote in message:
> > > > I use $mycounter, not saying it is pretty. But if you have a whole
> bunch
> > > of stuff deleted, your last id might be worth a lot more than the actual
> > > number of rows.
> > > >
> > > > $myconnection = mysql_connect($server,$user,$pass);
> > > > mysql_select_db($db,$myconnection);
> > > >
> > > > $news = mysql_query('select * from '.$table.' where '.$where.' order
> by id
> > > asc');
> > > >  $mycounter = 0;
> > > >  while ($mydata = mysql_fetch_object($news))
> > > >  {
> > > >   $mycounter++;
> > > >  }
> > >
> > > Have you ever considered just doing a count()?
> > >
> > > $count = @mysql_query("select count(*) from [table(s)] where [criteria
> > > [group by something]]");
> > > $total = mysql_result($count, 0);
> > >
> > > That will return the number of rows in your table(s). It's also much
> quicker
> > > and less resource intensive, particularly with large datasets. :)
> > >
> > > James
> > >
> > >
> > >
> > > --
> > > 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] is there php equiv left() and right() functions?

2002-12-18 Thread Philip Olson

You want explode(), something like:

  list($a, $b) = explode('|', $string);


Regards,
Philip Olson


On Wed, 18 Dec 2002, Jeff Bluemel wrote:

> I have a string that will look like the following;
> 
> data1|data2
> 
> now - I need to put data1 in a variable, and data2 in another variable.
> I've found the functions strlen, and strpos, but I can't figure how to grab
> this data.
> 
> thanks,
> 
> Jeff
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] Question about the exit() command

2002-12-19 Thread Philip Olson

How about:

  if (!$conn = mysql_connect($host, $user, $pass)) {
  include 'static_html.inc';
  exit;
  }

  print "Welcome, yes the database is connected";

exit ends the script, nothing after its use is executed.


Regards,
Philip Olson


On Thu, 19 Dec 2002, Beauford.2002 wrote:

> Hi,
> 
> Could someone clarify this for me. I want to be able to exit out of a PHP
> webpage and return to the calling page if certain conditions are not met. It
> appears using exit() will do this, but I am unclear exactly how to use it.
> 
> any info is appreciated.
> 
> TIA
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




RE: [PHP] Problem with sessions.

2002-12-19 Thread Philip Olson

For the record, variables are case sensitive so it's
$_SESSION not $_session.

And if you're going to use $_SESSION (which you should),
do not use session_register().

Regards,
Philip


On Thu, 19 Dec 2002, Mike Hillyer wrote:

> I have recieved a private response, it appears my system had
> register_globals off and the other server would have had it turned on. The
> proper usage was actually $_session["name"] and I shall be using that.
> 
> This was my first use of the PHP mailing list and I am very impressed and
> pleased with all the quick and helpful responses. Thank you all.
> 
> Mike Hillyer
> 
> -Original Message-
> From: Quentin Bennett [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 19, 2002 5:24 PM
> To: PHP GENERAL LIST
> Subject: RE: [PHP] Problem with sessions.
> 
> 
> Hi,
> 
> Is your 'other server' identical (Web Server, PHP Version, register_globals
> setting)?
> 
> Quentin
> 
> -Original Message-
> From: Mike Hillyer [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 20 December 2002 12:43 p.m.
> To: PHP GENERAL LIST
> Subject: [PHP] Problem with sessions.
> 
> 
> Hello All;
> 
> Please forgive me if I am repeating an often asked question, but I am having
> a problem with sessions. I simply cannot get them to work.
> 
> The sample code I provide works on another server perfectly, this is the
> first page:
> 
>  
>  session_start();
>  session_register("name","pass");
>  $name = "hilde";
>  $pass = "mypassword";
>  echo "Session variables set!";
>  echo "go to next page";
> 
> ?>
> 
> When called, the following file arrives in /tmp:
> 
> sess_f9c5e87b35ae66eac64a9a346321b269
> 
> name|s:5:"hilde";pass|s:10:"mypassword";
> 
> 
> 
> So obviously the session file is being created.
> However, when I go to page2.php?PHPSESSID=f9c5e87b35ae66eac64a9a346321b269
> Which has this code:
> 
>   session_start();
>  echo "The password of $name is $pass ";
> 
> ?>
> 
> I get "The Password of  is "
> 
> As a response. Both pages work perfectly on another server, so I am having
> trouble finding the problem, especially since the session file is actually
> created in /tmp
> 
> My PHP.ini file is standard to a RedHat RPM install, but I will include it
> as an attachment.
> 
> Any help would be greatly appreciated!
> 
> Mike Hillyer
> 
> The information contained in this email is privileged and confidential and
> intended for the addressee only. If you are not the intended recipient, you
> are asked to respect that confidentiality and not disclose, copy or make use
> of its contents. If received in error you are asked to destroy this email
> and contact the sender immediately. Your assistance is appreciated.
> 
> --
> 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] syntax to reference $_POST within function

2002-12-19 Thread Philip Olson

First, read this:

  http://www.php.net/variables.external

Second, assuming you have a PHP version equal to
or greater than 4.1.0 and the method of the form
is POST, you'd do something like this:

  $banlist = array('[EMAIL PROTECTED]');
  echo check_banlist($banlist, $_POST['email']);

Your question sounds like you're wondering if the
function definition should change, it doesn't.  You
leave it as $email and use $email within the function.
This is just how functions work, you pass in values.
So:

  function foo ($email) {
  print $email;
  }

  foo($_POST['email']);

  // Or as you used to do with register_globals
  foo($email);

Or you could always just do:

  function bar () {
  print $_POST['email'];
  }

  bar();

This is why they are SUPERglobals, because this is
what you would have done in the past (old school):

  function baz () {
  global $email, $HTTP_POST_VARS;

  print $email;

  print $HTTP_POST_VARS['email'];
  }

Also it's worth mentioning that $HTTP_POST_VARS has 
existed since PHP 3, so just in case that might be 
important to you too.  It is not super.

Now if you don't care if 'email' comes from GET, POST,
or COOKIE ... you could use $_REQUEST['email'].  Or,
import_request_variables() is another option.  For
example:

  import_request_variables('p', 'p_');

  print $p_email;

See the manual for details, and have fun!  It really
isn't that complicated and you'll be yelling out
Eureka! pretty soon now.

Regards,
Philip Olson

P.s. Superglobals work with register_globals on or off.


On Thu, 19 Dec 2002, Jamie wrote:

> I am attempting to modify an old script to support the superglobal 
> $_POST with register_globals=Off.  These register globals are definately 
> challenging when you are new to php and every example shown anywhere 
> uses the old method but I guess what doesn't kill you only makes you 
> stronger.
> 
> I am trying to convert this line, $email is coming from an html form so 
> I would typically call it with $_POST['email'] but this doesn't work in 
> this case and I thus far haven't been able to find anything that 
> explains what I should be doing.
> 
> function check_banlist($banlist, $email) {
> 
> Any assistance is appreciated!  Thanks,
> 
> Jamie
> 
> 
> -- 
> 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] Alternating Links

2002-12-19 Thread Philip Olson

This faqt answers your question:

  http://www.faqts.com/knowledge_base/view.phtml/aid/8583

Regards,
Philip Olson


On Fri, 20 Dec 2002, conbud wrote:

> Hi.
> Lets says I have 8 links stored in a database, extracting those links is 
> no problem. Now lets says I have 2 columns, how do I get link 1 into 
> column 1 then get link 2 into column 2  then link 3 into column 1 and 
> link 4 into column 2 and so on...
> 
> 
> 
> This is column 1
> This is column 2
> 
> 
> 
> --
> Conbud
> Graphic & Web Design Using Open Source Technology
> --
> 
> 
> -- 
> 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] syntax to reference $_POST within function

2002-12-20 Thread Philip Olson

This is a very important point to understand, I tried (and
failed) to explain it.  I think Leif made it pretty
clear though, here's another :)

// $a can be anything when you call the function
function bar ($a) {
print $a;
}

bar ('Hello World');
bar ($_POST['something']);

Regards,
Philip Olson


On Fri, 20 Dec 2002, Leif K-Brooks wrote:

> You don't need to import the request variables for that to work.  The 
> variable names in the function definition have no relationship to 
> variables outside of it.  Most likely, you're calling with something like:
> check_banlist($banlist,$p_email);
> but you could also call it with:
> check_banlist($variable_with_a_totally_different_name,$another_oddly_named_variable);
> or call it with
> check_banlist('some string','another string');
> or even call it with
> check_banlist($banlist,$_POST['email']);
> so importing the request variables is pointless.  What you call the 
> variables inside the function doesn't have anything to do with whether 
> there is a global variable with the same name!
> 
> Jamie wrote:
> 
> > Thanks for the vote of confidence.  I ended up getting it working with 
> > this:
> >
> > import_request_variables('p', 'p_');
> > function check_banlist($banlist, $p_email) {
> >
> > This is what I had been trying to accomplish but was writing it this way:
> >
> > function check_banlist($banlist, $_POST['email']) {
> >
> > Maybe you could also point me to the lesson that needs to be learned 
> > here.  Is it that it is an array?  or syntax?
> >
> > Thanks for the assistance!
> >
> > Jamie Sullivan
> >
> > Philip Olson wrote:
> >
> >> First, read this:
> >>
> >>   http://www.php.net/variables.external
> >>
> >> Second, assuming you have a PHP version equal to
> >> or greater than 4.1.0 and the method of the form
> >> is POST, you'd do something like this:
> >>
> >>   $banlist = array('[EMAIL PROTECTED]');
> >>   echo check_banlist($banlist, $_POST['email']);
> >>
> >> Your question sounds like you're wondering if the
> >> function definition should change, it doesn't.  You
> >> leave it as $email and use $email within the function.
> >> This is just how functions work, you pass in values.
> >> So:
> >>
> >>   function foo ($email) {
> >>   print $email;
> >>   }
> >>
> >>   foo($_POST['email']);
> >>
> >>   // Or as you used to do with register_globals
> >>   foo($email);
> >>
> >> Or you could always just do:
> >>
> >>   function bar () {
> >>   print $_POST['email'];
> >>   }
> >>
> >>   bar();
> >>
> >> This is why they are SUPERglobals, because this is
> >> what you would have done in the past (old school):
> >>
> >>   function baz () {
> >>   global $email, $HTTP_POST_VARS;
> >>
> >>   print $email;
> >>
> >>   print $HTTP_POST_VARS['email'];
> >>   }
> >>
> >> Also it's worth mentioning that $HTTP_POST_VARS has existed since PHP 
> >> 3, so just in case that might be important to you too.  It is not super.
> >>
> >> Now if you don't care if 'email' comes from GET, POST,
> >> or COOKIE ... you could use $_REQUEST['email'].  Or,
> >> import_request_variables() is another option.  For
> >> example:
> >>
> >>   import_request_variables('p', 'p_');
> >>
> >>   print $p_email;
> >>
> >> See the manual for details, and have fun!  It really
> >> isn't that complicated and you'll be yelling out
> >> Eureka! pretty soon now.
> >>
> >> Regards,
> >> Philip Olson
> >>
> >> P.s. Superglobals work with register_globals on or off.
> >>
> >>
> >> On Thu, 19 Dec 2002, Jamie wrote:
> >>
> >>
> >>> I am attempting to modify an old script to support the superglobal 
> >>> $_POST with register_globals=Off.  These register globals are 
> >>> definately challenging when you are new to php and every example 
> >>> shown anywhere uses the old method but I guess what doesn't kill you 
> >>> only makes you stronger.
> >>>
> >>> I am trying to convert this line, $email is coming from an html form 
> >>> so I would typically call it with $_POST['email'] but this doesn't 
> >>> work in this case and I thus far haven't been able to find anything 
> >>> that explains what I should be doing.
> >>>
> >>> function check_banlist($banlist, $email) {
> >>>
> >>> Any assistance is appreciated!  Thanks,
> >>>
> >>> Jamie
> >>>
> >>>
> >>> -- 
> >>> PHP General Mailing List (http://www.php.net/)
> >>> To unsubscribe, visit: http://www.php.net/unsub.php
> >>>
> >>
> >>
> >
> >
> >
> 
> -- 
> The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
>to decrypt it will be prosecuted to the full extent of the law.
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] the numeric key of an array???

2002-12-20 Thread Philip Olson

No, but you can do this:

  $arr2 = array_values($array);

  print $arr2[0]; // VALUE1

Regards,
Philip Olson


On Fri, 20 Dec 2002, Alexander Guevara wrote:

> How can i do for printing the value of an array given the numeric key for
> example i have this code:
> 
> $array = array (
> 'VAL1' => "VALUE1",
> 'VAL2' => "VALUE2",
> 'VAL3' => "VALUE3"
> )
> 
> So the only way i have found to print the value is like this :
> echo $array['VAL1'];
> 
> and it prints = VALUE1 but i want to know if its possible to do it something
> like this:
> echo $array[0];
> i mean give the numeric key for printing VALUE1 so instead the string key
> (VAL1) use the numerc (0)
> 
> Thanks in advance!
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] Is there any method to filter the single quote from astring?

2002-12-20 Thread Philip Olson

He is referring to a question that is answered here:

  http://www.php.net/manual/en/faq.html.php#faq.html.encoding

Spoiler: htmlspecialchars() -> http://www.php.net/htmlspecialchars

Regards,
Philip Olson


On Sat, 21 Dec 2002, Justin French wrote:

> on 21/12/02 2:00 PM, Alexander Guevara ([EMAIL PROTECTED]) wrote:
> 
> > It works.. but when you retrieve the data from the database to a text box it
> > doesnt appear if it has the single quote ('), o tought it was cause i have
> > the stripslashes but i delete stripslashes and it still doesnt appear in the
> > text box!
> 
> Huh?  I can't really understand what you're saying.
> 
> If you're adding stuff to a database, and getting an error, use
> addslashes(), then on the way out of the database, you need to
> stripslashes(). Easy.
> 
> If you don't get any errors, then magic quotes is probably enabled in your
> php.ini file.
> 
> 
> Justin
> 
> 
> 
> 
> > "Justin French" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > don't filter the quotes... escape them with add_slashes()
> > 
> > justin
> > 
> > on 20/12/02 10:50 PM, ªüYam ([EMAIL PROTECTED]) wrote:
> > 
> >> as title that I'm getting a trouble on filtering the single quote '  ,
> > since
> >> there would be error when storing those string into MySQL, thus, i have to
> >> find the appropriate method to solve it, anybody can help please?
> >> thx a lot
> >> 
> >> 
> > 
> > 
> 
> 
> -- 
> 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] Forms and PHP variables

2002-12-21 Thread Philip Olson

Use is_numeric()

  http://www.php.net/is_numeric

See also the ctype functions which can
be read about here:

  http://www.php.net/ctype

And yes, regular expressions are another
option but aren't needed here.

Regards,
Philip Olson


On Sat, 21 Dec 2002, Beauford.2002 wrote:

> Hi,
> 
> First off, thanks to all those that helped out with my other questions. Not
> all my problems were solved, but I'm certainly closer. Still working on the
> same project I need to do the following.
> 
> I have a form where users input numbers only, is there a way I can have php
> check to make sure a letter or other character didn't get put in by
> accident. I was looking at ereg, but not to familiar with this or if it
> would work in this case.
> 
> TIA
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] Loading modules not compiled in php

2002-12-21 Thread Philip Olson

Aspell is deprecated in favor of Pspell in PHP so
using it is a bad idea.  But you can do this to
get Pspell going:

a) On either the JTL box or on some other one
   with the same operating system, get the php
   source and get ready to compile.

 http://www.php.net/downloads

b) Be sure the appropriate libraries are available
   as per the instructions found here:

 http://www.php.net/pspell

c) Configure PHP like so:

 ./configure --with-apxs --with-pspell=shared

d) Then build it:

 make

e) This will then create the module which will
   exist in:

 yourphpsourcedir/modules/pspell.so

f) Copy this file somewhere on your web server and 
   in the php script load it with dl() like so:

 dl('pspell.so');

Easier said then done I know but the above is a
possibility ;)  You may want to ask them if they
could create this .so so that clients can load
it dynamically, that would be ideal.

Regards,
Philip Olson


On Sun, 22 Dec 2002, Tony Earnshaw wrote:

> >I have a site hosted at JTL Networks, and I'm looking into setting up
> > a spell checker for my message boards.  The problem is, JTL doesn't have
> > pspell compiled in with their php build, and it may be some time before
> > they do (if they ever do).  Does anyone know of a way to include
> > something like pspell support in php dynamically?  Like by using a
> > .htaccess file to call it or something?
> 
> At the last count (Apache 1.3.27/PHP4.2.3), aspell doesn't get compiled into
> PHP. It just sits in /usr/bin on RH Linux, at least..
> 
> The bad news is, that your code will have to be written for it. The good news
> is, that you can cheese the code off Horde's Imp.
> 
> Best,
> 
> Tony
> 
> -- 
> 
> When all's said and done, there's nothing left to say or do ...
> http://www.billy.demon.nl
> 
> -
> 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
> 


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




Re: [PHP] Forms and PHP variables

2002-12-22 Thread Philip Olson

is_numeric() will work with variables just fine. So:

  if (is_numeric($var)) {
  print "Yep, it's numeric";
  } else {
  print "Nope, it sure isn't a number";
  }

Make sure $var is defined.  If it's coming from a
form then use $_POST['var'] or similar instead for
reasons described here:

  http://www.php.net/variables.external

Regards,
Philip Olson

On Sat, 21 Dec 2002, Beauford.2002 wrote:

> Thanks for the info, but . is_numeric does not appear to accept
> variables  i.e. is_numeric($num) and ctype gives me the following.
> 
> Fatal error: Call to undefined function: ctype_digit() in
> /usr/local/apache/htdocs/.. on line 6
> 
> 
> 
> 
> - Original Message -
> From: "Philip Olson" <[EMAIL PROTECTED]>
> To: "Beauford.2002" <[EMAIL PROTECTED]>
> Cc: "PHP General" <[EMAIL PROTECTED]>
> Sent: Saturday, December 21, 2002 9:50 PM
> Subject: Re: [PHP] Forms and PHP variables
> 
> 
> >
> > Use is_numeric()
> >
> >   http://www.php.net/is_numeric
> >
> > See also the ctype functions which can
> > be read about here:
> >
> >   http://www.php.net/ctype
> >
> > And yes, regular expressions are another
> > option but aren't needed here.
> >
> > Regards,
> > Philip Olson
> >
> >
> > On Sat, 21 Dec 2002, Beauford.2002 wrote:
> >
> > > Hi,
> > >
> > > First off, thanks to all those that helped out with my other questions.
> Not
> > > all my problems were solved, but I'm certainly closer. Still working on
> the
> > > same project I need to do the following.
> > >
> > > I have a form where users input numbers only, is there a way I can have
> php
> > > check to make sure a letter or other character didn't get put in by
> > > accident. I was looking at ereg, but not to familiar with this or if it
> > > would work in this case.
> > >
> > > TIA
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 
> 
> -- 
> 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] Tutorials on OOP

2002-12-22 Thread Philip Olson

This tutorial lists many oop tutorials:

  Know of any basic tutorials on PHP Classes and OOP?
  ---
  http://www.faqts.com/knowledge_base/view.phtml/aid/7569

Regards,
Philip Olson


On Mon, 23 Dec 2002, Wee Keat wrote:

> 
> > Hi Justin,
> >
> > Thanks for your quick reply.. Well in this case i needs to build em
> > myself, because i am doing a course called Masterclass PHP and i have to
> > learn OOP.. So i am looking for some good OOP tutorials/examples on the
> > web I am very interested in creating a user login class using
> > sessionsDo u know any good sites where i can find tutorials/examples
> > about this.?
> >
> 
> If that's the case... u can try looking at these tutorials on Zend.com...
> 
> http://www.zend.com/zend/tut/tutorial-johnson.php
> http://www.zend.com/zend/tut/tutorial-johnson2.php
> 
> As well as these ones on DevArticles.com
> 
> http://www.devarticles.com/art/1/241
> http://www.devarticles.com/art/1/245
> http://www.devarticles.com/art/1/262
> http://www.devarticles.com/art/1/285
> 
> HTH!
> 
> Yours,
> Wee Keat
> 
> 
> "Good timber does not grow with ease; the stronger the wind, the stronger
> the trees."
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] forum?

2002-12-24 Thread Philip Olson

Another good one:

  fudforum:
http://fud.prohost.org/

Regards,
Philip

On Tue, 24 Dec 2002, [windows-1254] Fatih Üstündað wrote:

> do you know freeware forum in php I can easly use?
> 
> thanks.
> fatih ustundag
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] Problem with Include

2002-12-24 Thread Philip Olson

I've heard that RH8 decided to disable short tags
in their default php.ini  If this is true, the people
at RedHat deserve a good spanking.  Talk about being
irresponsible!

Regards,
Philip


On Tue, 24 Dec 2002, Tom Woody wrote:

> I have found this to be very true with RedHat 8 (includes Apache2.0.40,
> and php 4.2.2).  While RedHat 8.0 isn't really ready for a production
> server, apache2 and php definitly are not.  You have to bend over
> backwards to get some things working correctly if at all.  Plus there
> are still some stability issues with RH 8.
> 
> As far as my production servers go apache 1.3 and RH 7.3 for now.
> 
> On Tue, 24 Dec 2002 00:02:49 -0700
> Rick Widmer <[EMAIL PROTECTED]> wrote:
> 
> > At 08:04 AM 12/24/02 +0300, sport4ever wrote:
> > 
> > >maybe there is something wrong with php.ini
> > >notice that I faced with this problem just after I upgraded to (PHP
> > >4.2.1),(Apache2), everything was great before!
> > 
> > The last I heard PHP + Apache2 is pretty much experimental, and not 
> > recommended for production servers.  Unless you plan on working to
> > debug the combination of programs, you should be using Apache 1.3 if
> > you want to use PHP.
> > 
> > There are a few combinations of versions that work together, but
> > unless you are willing to put a lot of extra effort and study into
> > using Apache 2, stick with 1.3 until the PHP developers announce
> > Apache 2 support.
> > 
> 
> 
> -- 
> Tom Woody
> Systems Administrator
> 
> Don't throw your computer out the window, 
> throw the Windows out of your computer! 
> 
> 
> -- 
> 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] php4.3.0 & GD library

2003-01-05 Thread Philip Olson
On Sun, 5 Jan 2003, thkiat wrote:

> Do you kow how can I upgrade the PHP 4.1.1 in PHPTriad to PHP 4.3.0?
> I need PHP 4.3.0. as it includes a version of gd (GD Library) as "standard
> equipment."

GD is not "standard equipment", a "special" version 
is just bundled in PHP source now.  It sounds like 
you  are  using windows, this bundling has no affect 
on the windows distribution as it included all the 
pre-compiled binaries already, including GD's. In
fact, I bet you already have a GD binary and just
need to uncomment out in your php.ini but anyway
4.1.1 is old so you should upgrade.

Like with any version of PHP you download it and 
follow the install instructions.

  http://www.php.net/downloads

Regards,
Philip


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




Re: [PHP] REQUEST_URI, which part of $_ is it from??

2003-01-16 Thread Philip Olson

> Which part of $_ is the REQUEST_URI be found from?


It's a web server predefined variable so only lives
in $_SERVER.

  http://www.php.net/variables.predefined

Regards,
Philip


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




Re: [PHP] $HTTP_GET_VARS

2003-01-18 Thread Philip Olson

Everyone from this thread needs to reread this:

  http://www.php.net/variables.external

Regards,
Philip


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




Re: [PHP] Acessing $DOCUMENT_ROOT

2003-01-18 Thread Philip Olson
> How do I access $DOCUMENT_ROOT when register_gobals is set off?  I think
> there's an array, something like $HTTP_ENV_VARS['DOCUMENT_ROOT'] but I can't
> find it in the documentation.

http://www.php.net/variables.predefined

Regards,
Philip


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




Re: [PHP] image source from PHP

2003-01-23 Thread Philip Olson
> >



Regards,
Philip


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




Re: [PHP] Predefined Variables In Classes

2003-01-26 Thread Philip Olson

Read:
  http://www.php.net/variables.scope

Also note that $_SERVER is an autoglobal.

Regards,
Philip


On Sun, 26 Jan 2003, @ Nilaab wrote:

> Hello Everyone,
> 
> I am a little confused. Why do predefined variables like $PHP_SELF or
> $DOCUMENT_ROOT not process within a class, in the methods secifically. For
> example:
> 
>  class someClass {
> 
>function someFunction () {
>   $root = $DOCUMENT_ROOT;
>   return $root;
>}
> 
>function someFunction2 () {
>   $path = $this->someFunction() . $PHP_SELF;
>   return $path;
>}
> }
> ?>
> 
> I just threw this together to give you an example of how I might be using
> these two predefined variables in a class. The problem is that
> $DOCUMENT_ROOT or $PHP_SELF won't parse or something. It just returns blank.
> 
> It is included in another page when needed, say somePage.php. Shouldn't
> $PHP_SELF recognize the somePage.php as the current running script file, as
> opposed to the class file where these two functions are called? If it
> doesn't work that way then how do I do this without sending predefined
> variable parameters to these functions?
> 
> Please note that register globals is on. I could not find any documentation
> on this on php.net. Maybe someone can give me a hint of point it out for me
> on the documentation. 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] Java call on object causes segfault.

2003-01-26 Thread Philip Olson

Whenever you get a segfault, try the latest
stable release and during compile be sure to
use --enable-debug
:
  http://snaps.php.net/

If the segfault exists here, write a bug report
and include the backtrace:

  http://bugs.php.net/how-to-report.php
  http://bugs.php.net/

This will be of great help to the php-dev team. Also
I believe many changes to the Java extension went
into 4.3.0 so maybe it'll work for you.

Regards,
Philip


On Sun, 26 Jan 2003, John Wells wrote:

> Working on getting Java integration going.  I was able to get it to work
> with the online example and can create an object of java.lang.System and
> print various properties returned from there.
> 
> However, if I create my own class, I can instantiate it, but if I call a
> method on that class it causes a SIGSEV.
> 
> Could anyone provide some insight?
> 
> Here's the code and backtrace:
> 
> This is with Sun jdk 1.4.1_1, php-4.2.3 on Red Hat 8.0.
> 
>  
> $obj = new Java('com.x.reports.Serv');
> 
> print $obj->getMsg();
> ?>
> 
> --- java code stored off of class path in com/x/reports ---
> package com.x.reports;
> 
> class Serv
> {
> public String msg = "THIS IS A TEST MESSAGE";
> 
> Serv()
> {
> 
> }
> 
> public String getMsg()
> {
> return this.msg;
> }
> 
> }
> 
> -- BACKTRACE ---
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 8192 (LWP 9303)]
> 0x402da2cb in java_call_function_handler (ht=0, return_value=0x8114d14,
> this_ptr=0x810d604, return_value_used=1, property_reference=0xbfffdf54)
> at java.c:464
> 464 obj = zend_list_find(Z_LVAL_PP(handle), &type);
> (gdb) bt
> #0  0x402da2cb in java_call_function_handler (ht=0,
> return_value=0x8114d14, this_ptr=0x810d604, return_value_used=1,
> property_reference=0xbfffdf54) at java.c:464
> #1  0x40191553 in call_overloaded_function (T=0xbfffdf48, arg_count=0,
> return_value=0x8114d14) at zend_execute.c:953
> #2  0x40194636 in execute (op_array=0x8114b6c) at zend_execute.c:1660
> #3  0x401a40a3 in zend_execute_scripts (type=8, retval=0x0,
> file_count=3) at zend.c:812
> #4  0x401b5aaf in php_execute_script (primary_file=0xb450) at
> main.c:1383
> #5  0x401b0aba in apache_php_module_main (r=0x8107004,
> display_source_mode=0) at sapi_apache.c:90
> #6  0x401b18ea in send_php (r=0x8107004, display_source_mode=0,
> filename=0x8107b34 "/opt/apache_1.3.27/htdocs/t.php") at mod_php4.c:575
> #7  0x401b1963 in send_parsed_php (r=0x8107004) at mod_php4.c:590
> #8  0x08074880 in ap_invoke_handler ()
> #9  0x08088c76 in process_request_internal ()
> #10 0x08088cd6 in ap_process_request ()
> #11 0x0807ff9a in child_main ()
> #12 0x0808013a in make_child ()
> #13 0x080802a1 in startup_children ()
> #14 0x080808ce in standalone_main ()
> #15 0x080810ec in main ()
> #16 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] I'm new in PHP

2003-01-26 Thread Philip Olson
On Sun, 26 Jan 2003, Beogradjanin wrote:

> Zdravo php-general,
> 
>   Hi I have setup PHP Apache MySql.
>   I;m new in this stuff where can I learn hot to make web pages in
>   PHP...???

Go here:

  Learn HTML
  http://www.w3schools.com/html/

  Learn SQL
  http://www.w3schools.com/sql/
  http://www.sqlcourse.com/

  Learn PHP
  http://www.faqts.com/knowledge_base/view.phtml/aid/2836/fid/51
  http://www.php.net/manual/
  http://www.php.net/links.php

Regards,
Philip


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




Re: [PHP] Question about SSL/php globals

2003-01-27 Thread Philip Olson

On Mon, 27 Jan 2003, Wei Weng wrote:

> Is there any environment/Global variable in PHP that indicates whether the
> server port you connect to is SSL port?

$_SERVER['HTTPS']

Regards,
Philip


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




Re: [PHP] Strip_Tags @ php 4.3

2003-01-27 Thread Philip Olson
On Mon, 27 Jan 2003, George E. Papadakis wrote:

> Hello,
> 
> Has anyone noticed strange behaviour in strap_tags @ php 4.3?
> We did upgrade to the latest snap yet the problem remains. For some reason
> strip_tags acts weird..

Please be specific with a short self-contained example
that demonstrates your definition of "weird"

Regards,
Philip


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




Re: [PHP] output of fread() is blank

2003-01-27 Thread Philip Olson

On Mon, 27 Jan 2003, Guru Geek wrote:

> Hello,
> 
> I'm a recent convert from CGI/Perl and so am still getting my feet wet
> in PHP.
> 
> Here's my code:
> $filename = "http://www.myserver.com/include/sometext.txt";;
> $handle = fopen ($filename, "rb");
> $contents = fread ($handle, filesize ($filename));
[snip]

See:
  http://www.php.net/filesize

You cannot use it with urls.  Also if you can help it, 
don't go through http like this.  But anyway, see
also: file(), fgets(), and include()

Regards,
Philip


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




Re: [PHP] output of fread() is blank - FIXED - updated

2003-01-27 Thread Philip Olson
On Mon, 27 Jan 2003, Guru Geek wrote:

> Sorry, here is the code now ( I need a nap )
> 
> $filename
> ="/usr/local/plesk/apache/vhosts/myserver.com/httpdocs/include/text.txt";
> $handle = fopen ($filename, "r");
> $contents = fread ($handle, filesize ($filename));
> fclose ($handle);
> echo $contents;
> exit;

For something like this, just use readfile() and not fread 
as it'd be much more efficient if you don't actually manipulate 
the string $contents.  So:

  readfile($filename);  // note: do not use echo

Also, what is your include_path setting?  It's important
you know it and what it means as that'll answer the
question in your last post:

  print ini_get('include_path');
  http://www.php.net/manual/configuration.directives.php#ini.include-path

Also, no need for "exit" here as that happens automatically.

Regards,
Philip


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




Re: [PHP] Allowing . in $_POST variable

2003-01-28 Thread Philip Olson

Regarding keeping . as . and not _ in variables:

This isn't going to happen as it seriously breaks
BC.  This also would affect functions such as 
import_request_variables() and extract().  There
is no worthy benefit here, this will never happen.

Regards,
Philip









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




Re: [PHP] Form Variables not getting passed || Apache, MySql, Win2k Setup

2003-01-29 Thread Philip Olson

One too many $'s in your code, use:

$_REQUEST['my_passed_variable']

This is how all arrays work, autoglobals are the same.
See also:

http://www.php.net/variables.external
http://www.php.net/variables.predefined

Regards,
Philip

On Wed, 29 Jan 2003, CF High wrote:

> Hey all.
> 
> This driving me nuts:
> 
> I've got Apache, MySql, and Windows 2000 running on my local machine.
> In order to get passed php variables evaluated, whether via a url query
> string, or through a form post, I have to use this syntax:
> 
> $_REQUEST[$my_passed_variable]
> 
> I have no such problem with our hosting company servers; i.e. I can access
> query_string and form posted variables as $my_passed_variable.
> 
> What is going on here? Is there something in php.ini that needs to be
> adjusted?
> 
> Any help whatsoever here is much appreciated,
> 
> --Noah
> 
> --
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




RE: [PHP] Form Variables not getting passed || Apache, MySql, Win2k Setup

2003-01-29 Thread Philip Olson

> You never answered if this was in a function or class 
> method. Is it? Did you say whether it was Apache 1 or 2?

Also, to check what the register_globals setting really
is, make a call to phpinfo() as it will tell you the
true setting.  Sometimes the wrong php.ini is edited 
or the web server wasn't restarted or .htaccess/httpd.conf
gets in the way or ... ...

Regards,
Philip


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




Re: [PHP] Using custom "button" form element instead of standard"submit"?

2003-01-29 Thread Philip Olson

[snip]
> I assume i could use solution "A" above, and parse the _x out of the "name"
> value .. but this seems pretty hoaky and it's my understanding soultion B is
[snip]

This is how it's done.  If this is set, the button
was clicked.  For example:

  if (isset($_REQUEST['thebuttonname_x'])) {
  
  print "The button was clicked";
  }

Regards,
Philip
  


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




Re: [PHP] Using custom "button" form element instead of standard"submit"?

2003-01-30 Thread Philip Olson
On Thu, 30 Jan 2003, Chris Hayes wrote:

> At 12:18 30-1-2003, you wrote:
> >sure this would work but it'd be VERY inefficient in my application.  It's a
> >file browser application so i have hundreds of folder icons on a page .. the
> >'submit' element will pass back the name of the button clicked and it would
> >be available immediately/directly, which is what i want.  BUT an 'image'
> >element would require me to loop through ALL buttons doing an 'isset' test
> >on each one.
> * if there is not other data in the form you coudl turn it into an image 
> link and get the value in the $_GET
> * else walk through the $_GET vars (each key/value) untill you see a 
> varname that could be what you looked for.

Or why not:

  $lookingfor = 'somebutton';

  if (isset($_REQUEST[{$lookingfor . '_x'}])) {
  print "Found it, a button named $lookingfor was clicked";
  }

Or something, I think this is what you mean?  Whatever the
problem, there will be a solution ... don't stress :)  But
regarding the problem here, I don't get what you mean.  How
familiar are you with arrays?  Anyway, as Chris stated, the
name/value will be available in the appropriate autoglobal 
which will be $_POST or $_GET, and/or $_REQUEST.

> >I can't believe html provides no means for using an icon as a submit button.
> well it does doesn't it?
> 
> >by the way .. unrelated question ... why would one want to use
> >$_REQUEST['foo'] instead of just $foo? doesn't php give you access to form
> >variables using the latter construct which is much cleaner?
> not automatically anymore since PHP 4.10.
> and the exact reason was that the old way was NOT clean, see the release 
> notes for PHP 4.10 for the details.

It's as of PHP 4.2.0 that the default value of the
register_globals directive went from on to off.  It is 
this directive that pollutes your script with  these 
variables and it's recommended to not use them and
leave this deprecated directive off.  Now what happened
in PHP 4.1.0 was the introduction of autoglobals but
this is all described in various places in the manual
and here's such a place that links to others:

  http://www.php.net/variables.external

May as well read this too:

  http://www.php.net/release_4_2_0.php

Where have you been, hibernating? :)

Regards,
Philip



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




Re: [PHP] mysq_connect()

2003-01-30 Thread Philip Olson

On Thu, 30 Jan 2003, Cesar Rodriguez wrote:

> Hi there, my name is Cesar Rodriguez and I am trying to upgrade from Caldera
> Linux Server 2.3 into RedHat Server 8.0. The problem I encounter is that
> after testing different scripts, php is working, except when I make an MySQL
> call like mysql_connect() or mysql_pconnect().
> The call is as follows:
> 
> $link = mysql_connect('localhost', 'user1', 'passwd')
>   or exit();
> 
> mysql_select_db ('mydb')
> or exit ();
> 
> $result = mysql_query ('SELECT COUNT(*) FROM clients')
> or exit ();
> 
> if ($row = mysql_fetch_array ($result))
> .  etc ..
> 
> The message I get is:
> 
> "Fatal error: Call to undefined function: mysql_pconnect() in
> var/www/html/lesson/firsta.php"
> 
> Seems that PHP4 does not find the MySQL library. I checked php.ini and
> httpd.conf files and everything is in its place apparently. I re-installed
> everything from scratch with no positive result. I would appreciate advice
> on this issue.

Install the php-mysql rpm, restart apache, and they will
now exist. (assuming you already installed the mysql rpm)
In short, there are three rpms: php, mysql, and php-mysql.

  http://www.rpmfind.net/

Regards,
Philip


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




Re: [PHP] Form Processing - Multiple inputs of the same name

2003-01-31 Thread Philip Olson

On Fri, 31 Jan 2003, Tracy Finifter Rotton wrote:

> Change the name of your checkboxes in your HTML to something like:
> 
> name="DeleteIDs[]"
> 
> This will make it an array, and you can access all the elements like
> 
> $_POST['DeleteIDs'][0]
> 
> etc.
> 
> (This should really be in a FAQ somewhere...)


Using arrays with forms is in a faq:
  http://www.php.net/manual/en/faq.html.php#faq.html.arrays

How do you feel this should be expanded?  Mentioning that
unchecked checkboxes do not pass values, and that the
default value is 'on' (if checked) ... would be good too.

I remember posting some information on this topic in the past:
  http://marc.theaimsgroup.com/?l=php-general&m=101142826821051
  http://marc.theaimsgroup.com/?l=php-general&m=98576486229922

Anyway, I agree, just not sure if there should be one specific
faq for each form type, such as checkboxes or select boxes or... 
Ideally one faq would explain it for all types, checkboxes or
otherwise.  Making it short/concise and understandable for all
user levels (such as newbies) is the tricky part.  Well,
actually, the tricky part is convincing people to read faqs :)

Regards,
Philip


> On 1/31/03 11:17 AM, "Mike Potter" <[EMAIL PROTECTED]> wrote:
> 
> > Is it possible to pass an group of input boxes of the same name, then get
> > the values of all the checked boxes or filled out textboxes?
> > How do I get ALL the IDs passed.  Right now it only passes the last ID.  Do
> > I really have to give them all unique names?
> > 
> > For example...
> > 
> > 
> > 
> > 
> > 
> > 
> >  Jon Smith
> >  David Callow
> >  Peter Parker
> > .
> > .
> > .
> > 
> > 
> > 
> > 
> > 
> > This list of DeleteIDs will be build dynamically.  I want the user to be
> > able to check the boxes they want to delete and pull the IDs on the posted
> > page.
> > 
> > How do I get ALL the IDs passed.  Right now it only passes the last ID.
> > 
> > Thanks,
> > 
> > Mike
> > 
> > 
> 
> -- 
> Tracy F. Rotton
> [EMAIL PROTECTED]
> http://www.taupecat.com/
> 
>   "... I like the 49ers because they're pure of heart,
>   Seattle because they've got something to prove,
>   and the Raiders because they always cheat."
>  -- Lisa Simpson, "Lisa the Greek"
> 
> 
> -- 
> 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] 4.3 Install on Solaris

2003-01-31 Thread Philip Olson
On Fri, 31 Jan 2003, Weston Houghton wrote:

> 
> All,
> 
> I seem to be getting a silly error on Solaris when trying to do a PHP  
> 4.3 make. I get an error that looks to me like the liner arguments are  
> just too long. to be honest, I'm a bit stupified as to why this is  
> happening or how to fix it. FWIW, I have compiled 4.23 just fine on  
> that box.
[snip]

Are you using the GNU utilities?  PHP requires them, for example,
sed must be of GNU origin.  Same for bison, flex, etc.  This is
a common problem on Solaris these days as it comes with a broken
sed.  GNU good.

Regards,
Philip


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




Re: [PHP] Passing Variables

2003-02-01 Thread Philip Olson
On Sat, 1 Feb 2003, Beauford.2002 wrote:

> Hi,
> 
> Is there a way to pass a variable to a PHP script without using a form? I
> want to put several links on my main page that when clicked on goes to a PHP
> script - depending on what link was selected, will determine what part of
> the PHP script gets executed.

Yes, use GET:

  eat an apple

See also if() and switch()

  http://www.php.net/else
  http://www.php.net/switch
  http://www.php.net/variables.external

  print $_GET['fruit'];

Regards,
Philip


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




Re: [PHP] any change to see php source?

2003-02-01 Thread Philip Olson
> I am studying on php. And the book say, when the server see php extension it
> is running php file and giving results to the visiting browser.
> 
> But as I see related directories are normal directory, doesn' t like cgi-bin
> directories.
> 
> Is there any change to see php file source such as file open function or
> something else? I am not going to somebody else file. Just I want to be sure
> how secure the php?

It's all in CVS, read the source:

  http://cvs.php.net/
  http://www.php.net/anoncvs.php

You may also search the source in lxr:

  http://lxr.php.net/

Also, the following may be helpful to you:

  http://www.zend.com/phpfunc/

Regards,
Philip


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




Re: [PHP] Need to set default parameter || How to do in PHP?

2003-02-01 Thread Philip Olson
On Sat, 1 Feb 2003, CF High wrote:

> Hey all.
> 
> In cold fusion I was able to define a default value with the  "test" default = "myValue"> tag
> 
> When I passed the variable "test" via a form or query string, it would over
> ride the parameter value.
> 
> How can I do this in PHP?  I looked in PHP manual for param, default, etc.,
> but could find no equivalent.
> 
> Any ideas?

if (!isset($_REQUEST['rvar']) || inappropriate($_REQUEST['rvar'])) {
$rvar = 'default';
} else {
$rvar = $_REQUEST['rvar'];
}


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




Re: [PHP] using tags with php (IMPORTANT READ)

2003-02-01 Thread Philip Olson

On Sat, 1 Feb 2003, Sunfire wrote:

> if i do this:
> /*all the mysql login stuff here*/
> 
> $query=mysql_query("select * from members");
> while($new=mysql_fetch_array($query)){
> echo "$new['company']";
> /*so on through the field list*/
> }
> on output all i get is the title with a submit button..
> otherwise blank..

  There is a bug in PHP 4.3.0 regarding the use of arrays
  in strings.  The following gave a parse error before
  PHP 4.3.0:

print "Do not do this: $arr['key']";

  Now it gives an E_NOTICE error due to changes to the string
  scanner.  In PHP 4.3.1 it will no longer give a bogus E_NOTICE
  and instead it will work (no parse error either).  Surrounding
  the array with {braces} in the string works regardless, so:

print "You can do this: {$arr['key']}";

  Regarding this question, don't write it like that but instead
  do the following (no quotes needed):

echo $new['company'];

  For those wondering about this bug, see:

http://bugs.php.net/bug.php?id=21820

  The string documentation has been updated to demonstrate
  the array in string phenomena (except the bug hasn't been
  mentioned as I'm waiting for it to be committed first).

http://www.php.net/types.string

  Sunfire, you aren't seeing this E_NOTICE error because your
  error level is turned down (by default).  Put this on top 
  of your script to see them all:

error_reporting(E_ALL);

  Regards,
  Philip


> same thing with fetch_object()...and i have 1 row in the members table..im
> sort of confused now that it doesnt work for a wierd reason
> 
> any better ideas on how to get the stuff out of the table and into vars?
> maybe im doing it wrong
> 
> 
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, February 01, 2003 5:33 PM
> Subject: Re: [PHP] using  tags with php
> 
> 
> > In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time,
> > [EMAIL PROTECTED] writes:
> >
> > >i tried getting the values into vars using fetch_array/fetch_object and
> > >fetch_row and tried to put them in variables but for some odd reason it
> > >really doesnt work because when i try to use the vars in the value
> section
> > >instead of printing in the edit box the content of the variable i usually
> > >end up with "?>", ">", "" instead... any reason this shows
> > >up? and when i do:
> > >echo "";
> > >then on the web page i end up with some thing like this instead of the
> edit
> > >box:
> > >">";;">
> > >}?>
> > >any reason for that?
> >
> > It sounds like $name and/or $new_var may be empty. Did you echo the
> variables
> > before using them in your form to check whether the values from the
> database
> > are actually in the variables?
> >
> > Janet
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] using tags with php

2003-02-01 Thread Philip Olson
On Sat, 1 Feb 2003, Sunfire wrote:

> hi.. i took your idea...
> i put the error reporting code at the top of the script and ran it as the
> problem was still there to see what would happen.. instead i get 0 messages
> from the reporting system and all i get is the last 7 chars of the print
> line and the }?> at the end of the script... so for instance if i do:
> print(" or any variance of that statement changing around the \" and apostrophes
> around to try different things all i get is the rest of the script starting
> from the \n all the way to the rest of the script where it says }?> at the
> end dont know if this is a bug or not but its getting hard to figure out
> what the problem with my echo or print statements are...
> here is the whole script:
> its supposed to get all fields and then display in input text boxes the
> current values in that certain record  i know i missed some stuff in it with
> the query but at this point was supposed to be a test to see if i could even
> put it in the box in the first place... but here is the code:

Please step back, slow down, and write your question
in a short concise format.  I have no clue what the
above means.

> 
> 
> edit member
> 
> 
> 
> 
> pick some of these:
>  error_reporting(E_ALL);
> mysql_connect("192.4.5.6", "root", "");
> mysql_select_db("wata");
> $result=mysql_query("select * from members where company like 'test'");
> while($row=mysql_fetch_array($result)){
> print("\n\n");

// Try this instead, see also: htmlspecialchars()*
print "";

Regards,
Philip

* http://www.php.net/manual/en/faq.html.php#faq.html.encoding


> }
> ?>
> 
> 
> 
> 
> /*end*/
> any changes to make it work would be appreciated...tnx
> 
> 
> - Original Message -
> From: "Philip Olson" <[EMAIL PROTECTED]>
> To: "Sunfire" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Saturday, February 01, 2003 6:48 PM
> Subject: Re: [PHP] using  tags with php (IMPORTANT READ)
> 
> 
> >
> > On Sat, 1 Feb 2003, Sunfire wrote:
> >
> > > if i do this:
> > > /*all the mysql login stuff here*/
> > >
> > > $query=mysql_query("select * from members");
> > > while($new=mysql_fetch_array($query)){
> > > echo "$new['company']";
> > > /*so on through the field list*/
> > > }
> > > on output all i get is the title with a submit button..
> > > otherwise blank..
> >
> >   There is a bug in PHP 4.3.0 regarding the use of arrays
> >   in strings.  The following gave a parse error before
> >   PHP 4.3.0:
> >
> > print "Do not do this: $arr['key']";
> >
> >   Now it gives an E_NOTICE error due to changes to the string
> >   scanner.  In PHP 4.3.1 it will no longer give a bogus E_NOTICE
> >   and instead it will work (no parse error either).  Surrounding
> >   the array with {braces} in the string works regardless, so:
> >
> > print "You can do this: {$arr['key']}";
> >
> >   Regarding this question, don't write it like that but instead
> >   do the following (no quotes needed):
> >
> > echo $new['company'];
> >
> >   For those wondering about this bug, see:
> >
> > http://bugs.php.net/bug.php?id=21820
> >
> >   The string documentation has been updated to demonstrate
> >   the array in string phenomena (except the bug hasn't been
> >   mentioned as I'm waiting for it to be committed first).
> >
> > http://www.php.net/types.string
> >
> >   Sunfire, you aren't seeing this E_NOTICE error because your
> >   error level is turned down (by default).  Put this on top
> >   of your script to see them all:
> >
> > error_reporting(E_ALL);
> >
> >   Regards,
> >   Philip
> >
> >
> > > same thing with fetch_object()...and i have 1 row in the members
> table..im
> > > sort of confused now that it doesnt work for a wierd reason
> > >
> > > any better ideas on how to get the stuff out of the table and into vars?
> > > maybe im doing it wrong
> > >
> > >
> > > - Original Message -
> > > From: <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Saturday, February 01, 2003 5:33 PM
> > > Subject: Re: [PHP] using  tags with php
> > >
> > >
> > > > In a message dated 2/1/2003 2:02:06 PM 

Re: [PHP] Re: Register globals on and off

2003-02-01 Thread Philip Olson

On Sun, 2 Feb 2003, Pat Johnston wrote:

> I've read that an include file in each of your pages with the lines below
> should do the trick for you with register_globals OFF..
> 
> Not sure if this is a valid way to go though...
> 
>   extract($_SERVER);
>  extract($_ENV);
>  extract($_GET);
>  extract($_POST);
>  extract($_REQUEST);
> ?>

Whoever told you this should be shot as this is an enormous
security hole!  The above is a security hole much larger 
than register_globals could ever hope to be.  That and it's 
silly to attempt to mimic register_globals at runtime.

The above is insecure in that it will overwrite web server 
variables ($_SERVER) with request variables such as those 
from $_GET.  This is TERRIBLE!!!  Just imagine this as
just an example:

  http://www.example.com/a.php?PHP_SELF=http://www.foo.com

In the above scenerio, this would create $PHP_SELF
first from $_SERVER then it'd be overwritten by the
$_GET and than by the $_REQUEST that had the GET in
it.  So this makes it inefficient and insecure :) A
better example exists but anyway this should show a
nice point (like maybe PHP_AUTH_PW or REMOTE_USER).

Anyway, sorry for the rant but it's just that whoever
told you that should not tell anyone anything related
to this topic.

The best options are:
  a) rewrite the code or
  b) set register_globals with .htaccess or php.ini
 or in virtualhost in httpd.conf

  http://www.php.net/manual/en/configuration.changes.php

Now if you must set it at runtime (please do not do this)
then you could try this:

 // THIS IS NOT RECOMMENDED
 if (!ini_get('register_globals')) { 
   $types_to_register = array('GET','POST','COOKIE',
  'SESSION','SERVER'); 
   foreach ($types_to_register as $type) { 
 if (@count(${'HTTP_' . $type . '_VARS'}) > 0) { 
   extract(${'HTTP_' . $type . '_VARS'}, EXTR_OVERWRITE); 
 } 
   } 
 }
 // THIS IS NOT RECOMMENDED

Although it doesn't depend on the variables_order directive
like register_globals does, it is flexible.  Keep in mind
that variables are written from first to last so you
certainly don't want GET coming after SERVER.

Regards,
Philip



> "Davy Obdam" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hello people,
> >
> > On my development machine (win XP/Apache 2.0.44/PHP 4.3.0/MySQL 3.23.55)
> > i have several websites that i made some time ago that require register
> > globals to be On in the php.ini. Ofcourse i know thats not a good idea
> > at all for security, but rewriting all this code is not an option.
> > However in my php.ini i have set register globals to Off because that
> > better. Is it possible to configure my webserver/php so that only those
> > sites that require register globals to be On have that setting, for
> > instance in a .htacces file?? Any help is appreciated:-)
> >
> > Best regards,
> >
> > Davy Obdam
> > mailto:[EMAIL PROTECTED]
> >
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] help with script!!!

2003-02-01 Thread Philip Olson

On Sat, 1 Feb 2003, Karl James wrote:

> Hello guys and gals!!!
> 
> can you tell me why i can't get this script to print my 
> table
> 
> thanks Karl 
> 
> please check out the code below
> obviously i left my username and passwords blank :-)
> 
>  
> -
> 
>  $sqlhost = "localhost";
> $sqllogin = "login";
> $sqlpw = "password"; 
> $sqldb = "database table name";
> (@!mysql_pconnect($sql[localhost], $sql[wedbd13], $sql[webdb13])) {
> die(mysql_error()); }
> (@!mysql_select_db($sql[wedbd13])) { die(mysql_error()); }
> $result = mysql_query("SELECT * FROM `assignment_one`");
> while($array = mysql_fetch_array($result)) {
> echo("| %s | %s | %s | %s | %s |", $array[id], $array[username],
> $array[password], $array[status], $array[notes]);
> }
> ?>


Maybe this will help:

\n";
}
?>

Regards,
Philip


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




Re: [PHP] Line Number function?

2003-02-01 Thread Philip Olson
On Sun, 2 Feb 2003, Michael Sims wrote:

> On Sat, 1 Feb 2003 19:59:00 -0800, you wrote:
> 
> >PHP keeps track of what line# is being executed, so that when there's an 
> >error (say in pg_exec() ) it reports what line the error occured on. 
> [...]
> >Is there a function where I can access this information? Something like 
> >"get_line();" or something? 
> 
> Do you mean like the predefined "constant" __LINE__?
> 
> http://www.php.net/manual/en/language.constants.predefined.php

Yep, that will do it and has been available in PHP for a
very long time (along with __FILE__).  PHP 4.3.0 introduces
the following:

  __FUNCTION__   Function name
  __CLASS__  Class name
  debug_backtrace()  Debugging information including the
 line number

See: http://www.php.net/debug_backtrace

Regards,
Philip


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




Re: [PHP] help with script!!!

2003-02-02 Thread Philip Olson
On Sat, 1 Feb 2003, Hugh Danaher wrote:

> echo("| %s | %s | %s | %s | %s |", $array[id], $array[username],
> $array[password], $array[status], $array[notes]);
> 
> try
> echo "| %s | %s | %s | %s | %s |".$array[id]." ".$array[username]."
> ".$array[password]." ".$array[status]." ".$array[notes];
> 
> dots not comas between variables.

echo takes on commas as we can echo multiple variables which 
isn't something we can do with print.  This is also the main
difference between echo and print.  So, the commas are okay
here but as someone else already stated, echo doesn't behave 
like printf so no special %formatting% with echo.

Regards,
Philip


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




Re: [PHP] PHP version of ColdFusion CFParam

2003-02-02 Thread Philip Olson
On Sun, 2 Feb 2003, Lon Lentz wrote:
> 
>   Is there a PHP version of the ColdFusion tag ?

Go here:
http://marc.theaimsgroup.com/?l=php-general&s=cfparam

Regards,
Philip


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




Re: [PHP] Looping through the mysql_field_name function

2003-02-02 Thread Philip Olson
On Sun, 2 Feb 2003, Davy Obdam wrote:

> Hi ppl,
> 
> I have a problem that probably very simple, but i cannot figure it out 
> right now
> I need to get the field names of my database. I have a query like select 
> * from books and now i wanna have both the result and the field name. I 
> have been trying with mysql_field_name, but not succesfully...
> 
> $i = 0;
> for($a=0; $a < sizeof(mysql_field_name($db->sqlResult, $i)); $a++) {
> echo mysql_field_name($db->sqlResult, $i)."";
> $i++;
> }
> 
> Can anyone help me please.. Your help is greatly appreciated;-)

Please read the example in the manual as well as the user
contributed notes.  They show how to do this:

  http://www.php.net/mysql_field_name

See also: mysql_num_fields()

Regards,
Philip


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




Re: [PHP] listbox problems

2003-02-02 Thread Philip Olson
On Sun, 2 Feb 2003, Sunfire wrote:

> i have a listbox:
> 
>  //connect to db and get query
> mysql_connect(".");
> mysql_select_db("...");
> $query=mysql_query("select username from users);
> /*finish the listbox*/
> while($account=mysql_fetch_array($query)){
> echo "$account[username]";
> }
> ?>
> 
> 
> 
> got it to fill listbox with usernames..
> now my question is how do you use the $users variable in the php script that
> deals with the listbox?
> iat this point all i wanted to do was print the user name that was selected
> in the listbox but after i get how that works then it will load a form with
> all user data in it so it can be changed..

Read this:
  http://www.php.net/variables.external

Regards,
Philip


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




Re: [PHP] How can I display lastmodified for all my php-files?

2003-02-02 Thread Philip Olson
On Sun, 2 Feb 2003, Øystein Håland wrote:

> 
> "Jason Sheets" <[EMAIL PROTECTED]> skrev i meddelandet
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Take a look at the getlastmod() function, an example of the usage would
> be:
> 
> $last_mod = date ("F d Y H:i:s.", getlastmod());
> 
> Then you can print or operate on last_mod any way you want, if you don't
> want to operate on the date you can just print the return of date.
> 
> I use the getlastmod()function already, to print in the same document, but I
> recon this isn't exactly the same thing, since I want to display in ONE page
> the last modified date of all my php-files, or am I wrong?
> Some kind of array is necessary? I believe I need some kind of (recursive)
> function that collect this information from all my files, and I believe
> someone have written one already. I have not the skills (yet) to write it
> myself

See:
  http://www.php.net/readdir
  http://www.php.net/filemtime

The examples within will help you write this.

Regards,
Philip


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




Re: [PHP] authentication

2003-02-03 Thread Philip Olson

Read this:
  http://www.php.net/features.http-auth

Regards,
Philip


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




Re: [PHP] Re: Can anyone help me? i'm getting crazy... : |

2003-02-03 Thread Philip Olson
On Mon, 3 Feb 2003, Tomator wrote:

> User "Mr. Bungl3" <[EMAIL PROTECTED]> wrote:
> > I'm trying to delete a some records from a table with checkboxes and then
> i
> > have this code:
> >
> $sql="DELETE FROM divx where id=".$del[$i]."";
> 
> Great idea, but when checkbox is checked, variable of it's name just becomes
> true (doesn't get value of it's index anyway). So, I'd write it this way:
> 
> if ($del[$i]) {
>   $sql="DELETE FROM divx WHERE id='".$i."'";
>   mysql_query...;
> }

By default a checked checkbox has the value of 'on' but this
can be changed to anything.  So for example:

  

One can use IN to delete them all, for example:

  $ids = implode(',', $_POST['id']);

  $sql = "DELETE FROM divx 
  WHERE id IN ($ids)";

Anyway, you mention $del so you should make sure that
this variable even exists as for it to exist automatically
you need the register_globals directive to be on.  Odds 
are it's off and you should code with it off.  I assume
we are using method="POST" in the form.  See:

  http://www.php.net/variables.external

Debugging101 would have you do: print $sql;

And lastly, posting a TON of code won't get you very
far. I just ignored it and based my response on the
one above.

Regards,
Philip Olson


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




Re: [PHP] Html forms

2003-02-03 Thread Philip Olson
On Mon, 3 Feb 2003, Sunfire wrote:

> do this:
> run your php query to get the value of the text box and then do this:
>  //connect to db here
> $query=//put your query here
> while($foo=mysql_fetch_array($query)){
> //if you use mysql that is...
> echo "";
> }
> ?>

No offense Sunfire but I don't think you're ready to
be answering questions.  Please spend some more time
learning first and then start answering ;)  Although
your point of using quotes was good, just say so
without code as the above would always result in
the value "Array".

In a more general sense, it's most likely $Foo has a 
space in it or a quote or some  undesireable character:

  // good html
  

  // bad html (value becomes 'a' not 'a var')
  

  

Regarding other possible goodies in $var such as
characters like < or > or " or whatever ... read
this faq:

  http://www.php.net/manual/en/faq.html.php#faq.html.encoding

If the error is something else it's because you did
not describe the question very well.  Knowing the 
error would be a huge help.

Regards,
Philip


> 
> - Original Message - 
> From: "Todd Barr" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, February 03, 2003 9:59 AM
> Subject: [PHP] Html forms
> 
> 
> I am having difficulty putting results into an form
> 
> Once the query runs, I have this for my output
> 
> print "";
> 
> This results in an HTML error 
> 
> being apache finds an error AFTER the  tag
> 
> Any ideas?
> 
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




[PHP] Re: Etiquette

2003-02-03 Thread Philip Olson
On Mon, 3 Feb 2003, Chris Shiflett wrote:

> --- Philip Olson <[EMAIL PROTECTED]> wrote:
> > No offense Sunfire but I don't think you're ready to
> > be answering questions.
>
> Please try to be a little more kind. While his answer does
> have problems, his helpful attitude is a good thing.
>
> Whenever someone's answer can potentially do more harm than
> good (by misleading the original poster, as was a risk in
> this case), it might be better just to help correct the
> problems or offer a more proper solution. Degrading the
> person who erred does not really add any additional
> benefit.
[snip]

I've seen his questions and felt he's not ready to provide
answers.  Facts are facts, we all start somewhere.  Through
time Sunfire will learn PHP and provide useful replies. I
don't feel my reply was degrading.

You have cut-n-pasted my reply to be somewhat out of context.
At any rate, thanks, but I disagree.  I may have been a
little harsh but chalk it up as frustration towards some
of the replies I see on this list.  A lot of PHP newbies try
too hard to help so Sunfire, I am sorry if I offended you
but *my opinions* still stand.  Good luck with learning PHP.

Regards,
Philip



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




Re: [PHP] Is there a way to retrieve an entire source code from aphp file?

2003-02-04 Thread Philip Olson
On 4 Feb 2003, Adam Voigt wrote:

> I believe he meant the HTML source of an HTML page.

An example in the manual does exactly this:
  http://www.php.net/file

Regards,
Philip


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




Re: [PHP] Help Needed

2003-02-04 Thread Philip Olson
[snip]
> How should I display the page ... the page has a lot of html code and 
> trying to write echo "   blah  blah blah . ";
> will not be a an option. Please suggest a way out .

Use includes:
 http://www.php.net/include

And write HTML as HTML:

Greetings
Hello , we hope you 
enjoy this webpage.

Or a little heredoc:
 
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

Regards,
Philip


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




Re: [PHP] HTML if no PHP

2003-02-04 Thread Philip Olson

> I want to display an HTML page if PHP can't load an include 
> file or otherwise has an error or just doesn't work.
> How do I do this?

include returns false on failure and here's a hack to 
demonstrate.  Once you implement your own error
handling, be sure to set error_reporting accordingly
or supress with @.

if (!include('foo.php')) {
if (!include('static.html')) {
print 'ut oh, this is serious.';
}
}

Be sure to read about PHP's error handling capabilities to
do something more useful and/or create your own error
handling functions/system.

See also:  http://www.php.net/trigger_error
   http://www.php.net/set_error_handler
   http://www.php.net/ref.errorfunc

Regards,
Philip


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




Re: [PHP] How to get a certain line from a file

2003-02-04 Thread Philip Olson
On Tue, 4 Feb 2003, The New Source wrote:

> How can I get a certain line from a file?
> 
> If I get a file in this way:
> 
> $f = fopen("http://www.url.com/index.htm","r";); 
> 
> How can I get a certain line of the file index.htm?
> 
> I would need to get the line number 232, or lines from 232 to 238. How
> can I get this content?

Either loop through it with fgets() or simply use
file() and use the required array elements (lines).  
Most likely using fopen/fgets() will be more efficient 
as you won't need every line but file() is just so easy 
to use.  Although really this problem doesn't sound
very efficient to begin with, you may want to rethink
the logic here or ask your content provider for a RSS
version of the content or something...

See:
  http://www.php.net/file
  http://www.php.net/fgets

Regards,
Philip


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




Re: [PHP] include

2003-02-04 Thread Philip Olson
On Tue, 4 Feb 2003, Bob Lockie wrote:

> I don't appear to be able to use this variable in an include directive 
> because the variable is empty:
> include "$_SERVER['DOCUMENT_ROOT']
> 
> Do I have the syntax incorrect?

Please post the exact syntax as you did not as the
above will provide a serious parse error.  To test
if a value exists, do:

  var_dump($_SERVER['DOCUMENT_ROOT']);

Or phpinfo().  Now, going off a guess, try:

  include $_SERVER['DOCUMENT_ROOT'] . '/foo.php';

The following will NOT work in 4.3.0 as there
is a bug when using the following syntax:

  echo "$_SERVER['DOCUMENT_ROOT']";
  echo "Er, $iam['inastringand'] buggy in 4.3.0";

Note that the above gives a parse error in 4.2.3,
a bogus E_NOTICE error in 4.3.0, and will work (no
parse error) in 4.3.1.  Now, the following always 
works:

  echo "{$_SERVER['DOCUMENT_ROOT']}";
  echo "So {$i['willalwayswork']} yeah!";

Note: We are specifically talking about using arrays
within strings where the array key is quoted.

Regards,
Philip

P.s. Autoglobals, such a $_SERVER, became available in
PHP in PHP 4.1.0


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




Re: [PHP] include

2003-02-04 Thread Philip Olson
On Tue, 4 Feb 2003, Bob Lockie wrote:

> On 02/04/03 13:16 Philip Olson spoke thusly
> 
> > On Tue, 4 Feb 2003, Bob Lockie wrote:
> > 
> > 
> >>I don't appear to be able to use this variable in an include directive 
> >>because the variable is empty:
> >>include "$_SERVER['DOCUMENT_ROOT']
> >>
> >>Do I have the syntax incorrect?
> > 
> > 
> > Please post the exact syntax as you did not as the
> > above will provide a serious parse error.


> include "$_SERVER['DOCUMENT_ROOT']/visit_db.php";
> I am using 4.3.0, there is no release later.

  Then according to my post, this will not work and
  is affected by the mentioned bug.  So, rewrite it.

  Regards,
  Philip


> > To test
> > if a value exists, do:
> > 
> >   var_dump($_SERVER['DOCUMENT_ROOT']);
> > 
> > Or phpinfo().  Now, going off a guess, try:
> > 
> >   include $_SERVER['DOCUMENT_ROOT'] . '/foo.php';
> > 
> > The following will NOT work in 4.3.0 as there
> > is a bug when using the following syntax:
> > 
> >   echo "$_SERVER['DOCUMENT_ROOT']";
> >   echo "Er, $iam['inastringand'] buggy in 4.3.0";
> > 
> > Note that the above gives a parse error in 4.2.3,
> > a bogus E_NOTICE error in 4.3.0, and will work (no
> > parse error) in 4.3.1.  Now, the following always 
> > works:
> > 
> >   echo "{$_SERVER['DOCUMENT_ROOT']}";
> >   echo "So {$i['willalwayswork']} yeah!";
> > 
> > Note: We are specifically talking about using arrays
> > within strings where the array key is quoted.
> > 
> > Regards,
> > Philip
> > 
> > P.s. Autoglobals, such a $_SERVER, became available in
> > PHP in PHP 4.1.0
> > 
> > 
> 
> 
> -- 
> 
> Sent from Mozilla and GNU/Linux.
> Powered by an AMD processor.
> 
> 
> -- 
> 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] php4ts.dll

2003-02-14 Thread Philip Olson

Read this faqt:

  The PHP4TS.DLL file is linked to missing export 
  OLEAUT32.DLL:77 - Please help!!!
  ---
  http://www.faqts.com/knowledge_base/view.phtml/aid/15670/fid/30

If you happen to be using Win95, don't, because PHP does
not support Win95 as of PHP 4.3.0.

Regards,
Philip

p.s. google.com is your friend.



On Fri, 14 Feb 2003, Kristyna Tuckova wrote:

> 
> __
> > Od: Gabor Hojtsy <[EMAIL PROTECTED]>
> > Komu: Kristyna Tuckova <[EMAIL PROTECTED]>
> > CC: [EMAIL PROTECTED]
> > Datum: Thu, 13 Feb 2003 23:24:18 +0100
> > Pøedmìt: Re: php4ts.dll
> >
> > Please direct such questions to [EMAIL PROTECTED]
> > 
> > Goba [one [EMAIL PROTECTED]]
> > 
> > Kristyna Tuckova wrote:
> > > Hi.
> > > 
> > > I use php and apache and now I have a problem. If I try to open 
> some 
> > > file with php script, it says to me:
> > > 
> > > File php4ts.dll is conected to not existig export OLEAUT32.DLL:77
> > > 
> > > I have tryed to install everything once more, but it didn't help. 
> > > Could you be so pleased and help me?
> > > 
> > > thank you very much. 
> > > 
> > > Kristyna
> > > 
> > > 
> > > PØÍLOHA O DANÍCH! Interaktivní on-line formuláøe pro daòová 
> pøiznání a tiskopisy ke sta¾ení, adresáø finanèních úøadù na 
> http://finance.centrum.cz/dane2
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> 
> 
> 
> Poslouchejte Radio Impuls a vyhrajte víkendy pro dva v evropských
> metropolích. Více na Radiu Impuls a http://www.netimpuls.cz!
> 
> 
> 
> 
> -- 
> 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] "Constants" for dummies, please?

2003-02-21 Thread Philip Olson

Some thoughts on variables and constants:

a) You can't redefine a constant but can redefine
   a variable.

b) Constants are autoglobal (like superglobals) so
   for example:
   

   Had we not used global $variable, the $variable 
   would not have been available inside the function.
   But, the constant is AUTOglobal so it is.  Read:

 Variable Scope:
 http://www.php.net/variables.scope

c) Constants must be scalar values in PHP4, (so
   not arrays, objects, or resources).

d) Constants are cool, variables are cool too.

Regards,
Philip Olson


On Fri, 21 Feb 2003, Chris Corwin wrote:

> Help, please -- I've just started looking at my first line of PHP code.
> 
> :)
> 
> 
> A little background, I am *not really* a programmer: I went to art 
> school. 
> 
> I have taught myself to develop web stuff in another language: Lasso, 
> but have no training.
> 
> In any case, I am looking through a php script that I've downloaded, 
> and most of it makes at least some sense to me, but I have come upon:
> 
>
>   define('BASE', './');
>   include(BASE.'Functions/foo.php');
>   ?>
> 
> 
> Now, like any good lister, I checked the source first: php.net
> 
> <http://www.php.net/manual/en/language.constants.php> says:
> 
> "A constant is a identifier (name) for a simple value. As the name 
> suggests, that value cannot change during the execution of the script 
> (except the magic constants which aren't actually constants). A 
> constant is case-sensitive by default. By convention constant 
> identifiers are always uppercase. 
> 
> [...]
> 
> The scope of a constant is global--you can access it anywhere in your 
> script without regard to scope."
> 
> 
> 
> 
> So it is apparently *similar*, but not *exactly like* a variable, right?
> 
> Can anyone explain the difference to me?
> 
> A particular question I have is about what this phrase means:
> 
> "The scope of a constant is global--you can access it anywhere in your 
> script without regard to scope."
> 
> 
> 
> When it says "anywhere in your script" does that mean it's available to 
> "all of PHP"?
> 
> Or it is global to the rest of the file currently being processed, 
> regardless of namespace, unlike a "normal" variable which might be 
> unavailable in certain namespaces in the file?
> 
> Also, if anyone knows the subtleties of how any such differences effect 
> the rest of the script, that'd be wonderful, too.
> 
> 
> Thanks for any help!
> 
>   - me
> 
> -- 
> 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] states

2003-07-01 Thread Philip Olson
> Does anyone know of any built in functions or options for the US states?
> I want to make a drop down menu and some other things which have the 50
> states in it.  Is there any shortcut for this with PHP, or do I need to
> do it all manually in HTML?  Please let me know.  Thanks.

Here's one:
  http://px.sklar.com/code.html?id=164

Regards,
Philip


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



Re: [PHP] Problem with PHP installation Under windows 2003

2003-07-02 Thread Philip Olson
On Wed, 2 Jul 2003, Dennis Verdaasdonk wrote:
>  
> Hi there
> i was bussy with installing the PHP package under windows 2003
> when i do it with the CGI bin i ill always get error 404 and ca not find
> that problem
> when i use the ASPI way it's can not be loaded.. any idea please tell
> me.

There is an open doc bug on this, it appears IIS 6 requires an
extra step.  Have a look:

  http://bugs.php.net/bug.php?id=23907

Regards,
Philip


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



Re: [PHP] date() function and timestamps

2003-07-03 Thread Philip Olson

:)

You are using an m where you want an i.

Regards,
Philip


On Thu, 3 Jul 2003, Garrick Linn wrote:

> Hello all,
> 
> I seem to be running into a problem where the date() function appears not 
> to differentiate properly between unix timestamps.
> 
> For example, the code:
> 
>  
> $seconds = 1054278483;
> echo "$seconds";
> echo date("d-m-Y H:m:s", $seconds);
> echo "";
> 
> $seconds = ($seconds - 60);
> echo "$seconds";
> echo date("d-m-Y H:m:s", $seconds);
> echo "";
> 
> ?>
> 
> outputs
> 
> 1054278483
> 30-05-2003 02:05:03
> 
> 1054278423
> 30-05-2003 02:05:03
> 
> I would expect the second date() to output 30-05-2003 02:04:03 as the 
> second timestamp is exactly 60 seconds behind the first, but I might be 
> missing something.  I see the same behavior on two redhat linux machines 
> running Apache 2.0.40 + PHP 4.2.2 and Apache 1.3.26 + PHP 4.3.2 
> respectively.  Any ideas?
> 
> Thanks,
> 
> Garrick Linn
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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



Re: [PHP] how to :: multi select

2003-07-04 Thread Philip Olson
On Fri, 4 Jul 2003, Thomas Hochstetter wrote:

> Hi guys,
>  
> This might just be off the topic, but here it goes anyway:
>  
> How can one multi select check boxes and pass them through in php,
> without getting mixed up with variables (email multi select style).

Read these faqs:
http://www.php.net/manual/en/faq.html.php#faq.html.arrays
http://www.php.net/manual/en/faq.html.php#faq.html.select-multiple

Regards,
Philip


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



Re: [PHP] Q on echo phpinfo() ;

2003-07-05 Thread Philip Olson

You may set the location of php.ini by using the PHPRC 
environment variable or during ./configure use the
--with-config-file-path directive.  Maybe you should
just copy a php.ini into the directory PHP is looking for
it in, which appears to be C:\WINNIT.  If PHP was actually
reading a php.ini, you would have instead seen it as
C:\WINNIT\php.ini as opposed to just a directory path.  So
because no php.ini is being read, PHP is using all default
values as per a stock php.ini-dist.

http://www.php.net/manual/en/configuration.php
http://www.php.net/manual/en/faq.installation.php#faq.installation.phpini

Regards,
Philip


On Sat, 5 Jul 2003, jsWalter wrote:

> I ran this as a script from my Apache and it gave me a beautiful web page
> just full of wonderful information!
> 
> But I have a question on just 1 item...
> 
> Configuration File (piping) Path C:\WINNIT
> 
> How does this value get set?
> 
> My PHP is installed at 'G:\etc\php'
> 
> My php.ini is there as well.
> 
> The paths are set (in that ini file) as...
> 
> include_path = ".;G:\etc\php\extensions;G:\etc\php\pear"
> 
> extension_dir = "G:\etc\php\extensions"
> 
> Even My Apache is told to look there as well...
> 
> # Windows Win32 version
> 
> LoadFile "/etc/php/gnu_gettext.dll"
> 
> LoadModule php4_module "/etc/php/sapi/php4apache2.dll"
> 
> Action application/x-httpd-php "/etc/php/php.exe"
> 
> ScriptAlias /php/ "/etc/php/"
> 
> (pls don't comment about there being volume letters missing to this block,
> 
> I want to focus on the issue of a path being defined from out of the blue)
> 
> Is this being hard coded somewhere?
> 
> If so, then why does my PHP work at all?
> 
> I have nothing that belongs to PHP in the system directory.
> 
> Well, not completely true.
> 
> PEAR installed a pear.ini in the system directory itself (I wish it didn't,
> 
> but my PEAR not working properly is a different issue.)
> 
> Nothing I've read from the web or the documentation has given me any
> understand on how this is set and why PHP file are needed in the location
> that the says to place them.
> 
> I guess, this is a question for the folks who wrote the executables for
> Windows.
> 
> Thanks for any help and enlightenment.
> 
> Walter
> 
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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



Re: [PHP] Reading from remote file

2003-07-06 Thread Philip Olson

This is already fixed in CVS.  The entire example is bogus, 
it should not be using filesize($filename) either.

Here's what's in CVS (the manual will be rebuilt sometime
in the next week):

http://www.example.com/";, "rb");
$contents = "";
do {
$data = fread($handle, 8192);
if (strlen($data) == 0) {
break;
}
$contents .= $data;
} while(true);
fclose ($handle);
?>

And the whole point is to demonstrate the following note:

 "When reading from network streams or pipes, such as those 
  returned when reading remote files or from popen() and 
  proc_open(), reading will stop after a packet is available. 
  This means that you should collect the data together in 
  chunks as shown in the example below."

Have fun :)

Regards, 
Philip


On Sun, 6 Jul 2003, Daniele Baroncelli wrote:

> Hi guys,
> I am trying to read from a remote file, by using an example reported at the
> manual page for the fread function:
> 
>  $handle = fopen ("http://www.php.net/";, "rb");
> $contents = "";
> do {
> $data = fread ($handle, filesize ($filename));
> if (strlen($data) == 0) {
> break;
> }
> $contents .= $data;
> }
> fclose ($handle);
> ?>
> 
> 
> Unfortunately this example is incorrect, as it gives me a parse error. The
> mistake should be in the fact that there is a "do" keyword without a
> "while".
> Would anyone suggest me the correct version?
> 
> Cheers
> 
> Daniele
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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



Re: [PHP] how to modify in the db

2003-07-06 Thread Philip Olson


use UPDATE

Also, be sure to learn basic SQL before use:

http://www.w3schools.com/sql/
http://www.sqlcourse.com/
http://www.onlamp.com/pub/ct/19

Regards,
Philip


On Sun, 6 Jul 2003, Kevin Fradkin wrote:

> hi...
> i have this secuence to insert data to my db
> 
> mysql_query
> ("INSERT INTO my_table(
>  number,name,surname
> )
>  values ('$number','$name','$surname'
> )");
> 
> i want to ask what do i have to do if i want to modify instead of insert
> when this data already exists...
>  for example.. i have in my_table
> number name surname
> 1jhon smith
> 
> and i want to change the name...jhon --> john
> 
> and if that not exist create it...
> number name surname
> 0  mary   duke
> 1  charles emmerson
> 
> and add john's one.. ( to check if i can use only modify to add )
> 
> thnx!..
> 
> 
> 
> -- 
> 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] Warning: Invalid argument supplied for foreach()

2003-07-06 Thread Philip Olson

On Sun, 6 Jul 2003, arnaud gonzales wrote:

> Hi all,
> I am getting crazy, can't understand what i missed!
> Does anybody know?
> 
> $champs = array ("titre_art" => "h3" ,"nom" => "bleu", 
>  "prenom" => "green", "resume" => "bold");
> 
> foreach($champs as $key => $value) {
> echo "$row($key))";
> }

It works fine, you are using different code then the above.
In your actual code, make sure you pass in an array that
exists, as currently you are not.

One example reason, the foreach is inside a function and
$champs isn't available in the functions scope (global).

At any rate, before your foreach, var_dump($champs) and
it'll let you know what is up.

Regards,
Philip

p.s. In case $row is an array, you actually mean to write
it as $row[$key], but this is unrelated to the error that
foreach is providing.



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



Re: [PHP] print vs heredoc

2003-07-07 Thread Philip Olson
> As to which is faster is does not really matter as the speed of echo
> print and heredoc is dictated by the connection speed to the
> requesting client. If this is a factor in your overall operation you
> can use output buffering to save the contents and output them at the end of
> your script.

Although really, heredoc can't be compared to either
echo or print, as it's just a string definition that
eventually will be printed.  So I guess you guys are
really comparing "" vs heredoc?  And I agree that any
speed difference (if there is one) isn't a good reason
to choose when readablity may suffer.  So it all
depends on the situation, and the programmer.

> btw what would be nice is a print_raw command that does no
> parsing just sends the stuff :)
> (Would be good for template systems where you know there is no php
> hidden in there.) ... might gain a couple of micro seconds

I believe this is called "breaking out of PHP mode
and into HTML mode", which can be done anywhere, at
any time.

Regards,
Philip


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



RE: [PHP] $_POST problem

2003-07-09 Thread Philip Olson

The only time you want to use {braces} like that is
when you are in a string.  None of the suggestions
here are in strings, so the use of {braces} is bogus.
The following is good:

  echo "Hello {$there['friend']} is good";

Note how we're in a string.  This topic is very much
discussed (with loads of examples) here:

  http://www.php.net/types.string

Regarding the question in this thread, it's not clear
what you're problem is.  If the form is method POST,
and you have at least PHP version 4.1.0, there is a
100% chance that the name/value will live in $_POST.

  

  echo $_POST['foo'];

Not sure what the question is, could you be a little
more clear?  It seems you are mixing up img_keywords
and new_keywords, maybe that's it.  Debugging101
would say to check what's in $_POST, which could be:

  print_r($_POST);

Regards,
Philip



On Wed, 9 Jul 2003, Aaron Axelsen wrote:

>  
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Sometimes in situatinos like that, it does the trick for me, im not
> really sure why though .., I just now it works :)
> 
> - ---
> Aaron Axelsen
> AIM: AAAK2
> Email: [EMAIL PROTECTED]
> 
> Want reliable web hosting at affordable prices?
> www.modevia.com
>  
> Web Dev/Design Community/Zine
> www.developercube.com
> 
> 
> 
> - -Original Message-
> From: Joe Harman [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, July 09, 2003 11:09 PM
> To: 'Micah Montoy'; [EMAIL PROTECTED]
> Subject: RE: [PHP] $_POST problem
> 
> 
> Hey... Just for Sh** and giggles... Try removing the quotes from
> keywords
> 
> Make it look like this...
> 
> $img_keywords = trim({$_POST[keywords]})
> 
> Hmmm. Something is up here... Never seen curly brackets used like
> this... But that would probably be normal for me LOLjust
> thought I point out anything unusual...
> 
> 
> 
> - -Original Message-
> From: Micah Montoy [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, July 09, 2003 11:57 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] $_POST problem
> 
> 
> Nope.  That didn't do it.  The errors I'm receiving are:
> 
> Notice: Undefined index: keywords in
> c:\inetpub\wwwroot\webpage10\example\v_images\dsp_update_image.php on
> line 22 and
> 
> Notice: Undefined variable: img_keywords in
> c:\inetpub\wwwroot\webpage10\example\v_images\dsp_update_image.php on
> line 29
> 
> thanks
> 
> "Aaron Axelsen" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> >
> > Try:
> >
> > $img_keywords = trim({$_POST["keywords"]});
> >
> > - ---
> > Aaron Axelsen
> > AIM: AAAK2
> > Email: [EMAIL PROTECTED]
> >
> > Want reliable web hosting at affordable prices? www.modevia.com
> >
> > Web Dev/Design Community/Zine
> > www.developercube.com
> >
> >
> >
> > - -Original Message-
> > From: Micah Montoy [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, July 09, 2003 10:26 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] $_POST problem
> >
> >
> > Anyone see what when I submit this, I can't do a $_POST on it?  I
> > check with the DB first to see if there is a value and if so, I
> > fill  it, otherwise, it will return a blank for the user to fill if
> > they  want.
> >
> >  
> > ?>" size="53" maxlength="500">
> >
> > On the page that it goes to when it is submitted, the post looks
> > like this:
> >
> > $img_keywords = trim($_POST["keywords"]);
> >
> >
> > thanks
> >
> >
> >
> > - --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > -BEGIN PGP SIGNATURE-
> > Version: PGPfreeware 7.0.3 for non-commercial use
> >  
> >
> > iQA/AwUBPwzdn7rnDjSLw9ADEQIcCQCgkktDGf9u26bOntsqMPw93lpINdcAoM9h
> > tVqNcesMuM/L3fZaXmIdKdId
> > =fJlG
> > -END PGP SIGNATURE-
> >
> >
> 
> 
> 
> - -- 
> 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
> 
> -BEGIN PGP SIGNATURE-
> Version: PGPfreeware 7.0.3 for non-commercial use 
> 
> iQA+AwUBPwzqPLrnDjSLw9ADEQKPYgCgjokK/dQZwk10ylF+5Pjpz2YANisAmNGk
> LTtC/a1boJlKfxXawTNyDPs=
> =ptOt
> -END PGP SIGNATURE-
> 
> 
> 
> -- 
> 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] MySQL Results - display issue :S

2003-07-09 Thread Philip Olson
On Thu, 10 Jul 2003, Brenton Dobell wrote:

> I know im probibly getting irritating to most of you :P but i thought i may
> ask another thing that is on my mind!
> 
> I have a sql query bringing back 200 rows for arguments sake, From this i
> would like an answer to 2 issues i have.
> 
> 1) I know how to display it row after row going down :P duh of course :P,
> but i have seen sites where it goes across then down across then down ect
> ect like X -> X then next row ect. How is this done??

  http://www.faqts.com/knowledge_base/view.phtml/aid/8583

> 
> 2) How can i alternate the colours for each row?? row 1 eg light blue and
> the 2nd row dark blue then back to light blue ect ect.

  http://www.faqts.com/knowledge_base/view.phtml/aid/783

Regards,
Philip


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



RE: [PHP] $_POST problem

2003-07-09 Thread Philip Olson
On Thu, 10 Jul 2003, Joe Harman wrote:

> Yeah, me too... LOL... Although, I don't understand the curly
> brackets... I don't see any examples using them in the manual either...

Actually, the manual is pretty clear on this, and with tons
of examples:

  http://www.php.net/types.string
  http://www.php.net/types.array

It's just a matter of where to look :)

Regards,
Philip


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



Re: [PHP] What's this talk about ASP to PHP?

2003-07-10 Thread Philip Olson
On 10 Jul 2003, Jonathan Villa wrote:

> I've read somewhere about some asptophp convertor/tool/methodology...?? 
> Don't know what it is, that's why I'm asking.
> 
> I've been asked to help out on a project which might include some
> already developed basic ASP code.  I would rather do it in PHP.

  2. Is there an ASP to PHP converter?
  http://www.php.net/manual/en/faq.languages.php

Regards,
Philip


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



Re: [PHP] Password + login from the AND Basic-Authenticate form

2003-07-10 Thread Philip Olson
On Thu, 10 Jul 2003, Seigo wrote:

> Please tell me can users login with the html-page form and
> Basic-authentication?

  Chapter 16. HTTP authentication with PHP
  
  http://www.php.net/features.http-auth

Regards,
Philip


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



Re: [PHP] php mysql array question

2003-07-11 Thread Philip Olson
On Fri, 11 Jul 2003, CPT John W. Holmes wrote:

> > Is there any php function to pull a query into an array?  I know there is
> a
> > way to get the first row of the results in an array, but I'm having to
> loop
> > through each row pushing the row onto an array to get the result I'm
> looking
> > for and it seems like a lot of code for something that I would think is
> used
> > a lot.
> 
> There's no PHP function to do so. Some abastraction layers provide this, but
> it's just doing a loop like you're doing.
> 
> Show your code and we can offer tips on how to improve performance.

I'm glad this feature doesn't exist.  Just think how abused it would 
be, how many people would use it, when few would actually need it.  
Most people can use the data while in the loop, not after.  Or do
what is needed in the sql, not php.  Maybe I'm a little too parental 
though, but so be it. :)

Regards,
Philip


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



Re: [PHP] imagecreate() error

2003-07-12 Thread Philip Olson
Hello Michelle-

a) Only enable one GD dll, so use php_gd2.dll.
b) Consider using imagecreatetruecolor() instead but
   either will work.
c) When asking support questions, it's important to
   say exactly what version, although in this case
   we know it's 4.3.0-1 as php_gd.dll was removed in
   PHP 4.3.2

Anyway, enable just one dll and it should work.  Be sure
to restart the web server afterwards.

Regards,
Philip


On Sat, 12 Jul 2003, Michelle Bernard wrote:

> Hi there,
> 
> I am running PHP 4.3 something or other, I have enabled php_gd.dll and
> php_gd2.dll, pointed the extension directory to the right place, looked at
> the phpinfo and it has the correct information about the gd's being enabled,
> I have tried reintalling apache and php...but still get errors on all simple
> scripts that i have tried...
> 
> this is the error I get..
> 
> Fatal error: Call to undefined function: imagecreate()
> 
> any suggestions or tips?
> 
> Thank you!!!
> 
> Sincerely
> Michelle
> 
> 
> 
> -- 
> 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] Configuration Problems

2003-07-12 Thread Philip Olson

Here's a faq:

  http://www.faqts.com/knowledge_base/view.phtml/aid/15670/fid/30

You need to upgrade your old DCOM.

Regards,
Philip


On Sat, 12 Jul 2003, Arun wrote:

> I have installed Apache 2.0.47 and php 4.3.2 in Windows 98. Downloaded the
> php in the .zip format.
> 
> The Apache server works properly without the inclusion of php.
> The problem is apache dosent even start with php in the SAPI mode,it gives a
> error stating that:
> 
> "One of the device attached to the system isnt functioning properly"
> (or)
> "Library files missing"
> 
> and in the CGI mode the apache server starts and it executes the .html files
> but it dosent execute the .php file or the .html files with php commands
> giving an error statement:
> 
> "Internal Server Error
> The server encountered an internal error or misconfiguration and was  unable
> to complete your request."
> with a dialog box message stating that
> "The PHP4TS.DLL file is linked to missing export OLEAUT32.DLL:77."
> (I do have the OLEAUT32.DLL file in the same folder as the PHP4TS.DLL file)
> 
> I have copied all the .dlls and php.ini to their respective places as given
> in the manual but still dosent work.
> I am hoping some one could give me a suggestion or a solution to my problem.
> 
> 
> 
> -- 
> 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] Missing php.ini file

2003-07-14 Thread Philip Olson
On 14 Jul 2003, Chris Blake wrote:

> On Mon, 2003-07-14 at 14:13, John W. Holmes wrote:
> > .
> > 
> > You can normally just get a new php.ini from here:
> > 
> > http://cvs.php.net/co.php/php4/php.ini-dist
> > 
> > but it's giving a 505 error right now. May have to wait a bit.
> > 
> > First, create a PHP page with just the function  on it. 
> > Load up that page and look in the first block. Look for the line that 
> > says: Configuration File (php.ini) Path. If a php.ini file is listed 
> > there, that's the one that PHP is using. If just a path is shown, then 
> > PHP is using its defaults and that's where you should place the php.ini 
> > file when you get one. You can download the appropriate distro for your 
> > OS and just copy the php.ini from there, also. They are normally called 
> > php.ini-dist and php.ini-recommended that you rename into php.ini.
> > 
> > -- 
> > ---John Holmes...
> 
> 
> Thanks John,
> 
> I`m also getting the 505 and will check back later..
> 
> Thanks for the tip/link, much appreciated...

You'll be waiting a long time, until the end of time :)
Because the php4 module is now named php-src, so change
that in the url and you'll be set.

Regards,
Philip


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



Re: [PHP] Strange Problem

2003-07-14 Thread Philip Olson

This is an IIS issue.  The install.txt has specific
information on this topic, have a look.  Also, this comes
up a lot and the following bug report is full of newbies
asking bogus questions but it also contains some good info:

 http://bugs.php.net/bug.php?id=12061

So it looks like security/permission settings where the
php cgi lacks permission.  Also:

 http://php.net/manual/en/faq.installation.php#faq.installation.cgierror

Regards,
Philip



On Mon, 14 Jul 2003, Curt Zirzow wrote:

> Haseeb <[EMAIL PROTECTED]> wrote:
> >  
> >  
> > Hi all,
> > this is a very strange problem. i don't know where i am doing something that
> > is causing this. the problem is that i am working on a web portal  entirely
> > in  php. i have a few hidden pages. that do the queries to the DB. now when
> > i redirect to any page for query i get this error
> > CGI Error
> > The specified CGI application misbehaved by not returning a complete set of
> > HTTP headers. The headers it did return are:
> >  
> > strangely  when i hit F5 or refresh the page i get redirected to the desired
> > page. i have checked for any whitespaces. there are none. i have checked and
> > double checked this. i am using win2k,IIS, php 4.3.0
> >  
> 
> Have you checked your log file, usually there is an error in the log
> file telling you what went wrong.
> 
> 
> > again i have checked all the files for any space left that could be causing
> > problem but i found none.
> 
> This usually happens when non http headers are sent to the server when
> it wasnt expecting them, php should be handling this. But to check this
> make sure you try sending out a header('Content-Type: text/plain') first
> thing in the script then dont do a redirect and see if some text is
> showing up that shouldn't be.
> 
> >  
> > i hope i make my self clear.
> > Haseeb
>   
> 
> Curt.
> -- 
> 
> 
> -- 
> 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] Missing php.ini file

2003-07-14 Thread Philip Olson
> > You'll be waiting a long time, until the end of time :)
> > Because the php4 module is now named php-src, so change
> > that in the url and you'll be set.
> 
> Thanks. Someone needs to change the link in the Configuration chapter of the
> manual, too, b/c that's how I always find it. :)

Done, fixed in CVS!

Regards,
Philip


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



Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA

2003-08-01 Thread Philip Olson

Your script should work fine, and to fix claims made in
this thread:

  a) $HTTP_RAW_POST_DATA is NOT an array, it's a string.
  b) It does not live in $_SERVER, or rely on register_globals.

Your code is wrong because you don't provide names for your
fields, so there is no POST data.  Assign your text field
a name, and your submit field a name, and it will work.
Also, keep in mind that $PHP_SELF existing requires the
PHP directive register_globals to be on.

Regards,
Philip

p.s. 



On Fri, 1 Aug 2003, Balazs Halasy wrote:

> I need to have the contents of $HTTP_RAW_POST_DATA because of
> non-regular uploads (from browser to my home-made WevDAV server implementation 
> (done in PHP)). However, no matter what I
> do, it is always NULL. I guess the following script should return
> SOMETHING in $HTTP_RAW_POST DATA if "always_populate_raw_post_data = On" is
> added to the php.ini file (and yes, I've restarted apache :-)... so, why
> is it empty and how can I get the RAW post data? My PHP version is 4.3.2.
> 
> test.php: 
> 
>  
>  
>  
>  
>  echo("Raw post data: ".$HTTP_RAW_POST_DATA."\n"); 
> echo("Raw post data decoded:
> ".base64_decode($HTTP_RAW_POST_DATA)."\n"); 
> echo(""); 
> phpinfo(); 
> ?> 
> 
> 
> 
> Allman
> 
> 
> -- 
> 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] Old version of PHP

2003-08-10 Thread Philip Olson
> > > Thanks for all the feedback, guys. Is there an errata page somewhere
> > > lists known bugs in the PHP interpretter?
> >
> > google > php bugs
>
> I appreciate the (rather indirect) pointer to the PHP bug tracking site - I
> didn't know about that. Errata, it seems to me anyway, perform a different
> purpose. I don't mind RTFM-style responses, but please at least read my
> question more closely.
> 
> I find the "reporting bugs" link on the PHP website a bit misleading since
> that page serves more purposes than simply reporting bugs.

There is no Errata per se, but there is a changelog that
lists bugs/fixes and even links to the bug reports in
question.  One day the manual will have its own changelog
that will list every change, such as new parameters, 
name changes, default value changes, etc.  But it doesn't
exist yet.

Here are the changelogs:

  http://www.php.net/ChangeLog-4.php
  http://www.php.net/ChangeLog-5.php

Regards,
Philip


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



  1   2   3   4   5   6   7   >