php-general Digest 13 Feb 2001 08:38:31 -0000 Issue 509

Topics (messages 39255 through 39376):

Apache not starting after adding php via mod_so.
        39255 by: Sieger, Roland

Re: Regex help needed...
        39256 by: Jesse Swensen
        39260 by: Jason Stechschulte
        39270 by: Christian Reiniger
        39282 by: Jesse Swensen

Re: Search & replace text
        39257 by: Christian Reiniger

Re: rewriting this SQL statement to remove subselect
        39258 by: Christian Reiniger

mysql +php+ array
        39259 by: Ramiro Radjiman
        39267 by: Web master

strtotime problem running PHP as Apache module
        39261 by: Charles Mulford

sorting a csv text file in PHP
        39262 by: Mike Mike

returning multiple variables from a function?
        39263 by: James, Yz
        39265 by: Matt McClanahan
        39268 by: John Donagher
        39363 by: Ankur Verma

(g)Zip archiving of local files?
        39264 by: Michael Geary
        39310 by: Maxim Maletsky

Re: money maths
        39266 by: Christian Reiniger

Problems with ! in mail();
        39269 by: Curtis, Lorenzo
        39274 by: Christian Reiniger
        39277 by: Curtis, Lorenzo
        39278 by: Christian Reiniger
        39288 by: CC Zona
        39366 by: Ankur Verma

Broken icon?
        39271 by: Malouin Design Graphique
        39273 by: Web master
        39364 by: Ankur Verma

Re: comparisons
        39272 by: Christian Reiniger

Using PHP to process forms
        39275 by: Don
        39276 by: Joe Stump
        39311 by: Maxim Maletsky
        39365 by: Ankur Verma

Re: XML Parsing The Sequel II
        39279 by: Steve Haemelinck

input type equals image
        39280 by: matthewt tozer
        39281 by: Jason Murray

How to check if vaiable is defined or not?
        39283 by: SED
        39285 by: eschmid+sic.s.netic.de
        39287 by: Reuben D Budiardja
        39289 by: Brian V Bonini
        39367 by: Ankur Verma

PHP/Oracle mod
        39284 by: rbradley
        39291 by: Joe Conway

Nothing Showling up in Netscape
        39286 by: Peter Houchin
        39290 by: Jason Murray
        39323 by: Steve Werby
        39368 by: Ankur Verma

Re: Preserve variables between page loads?
        39292 by: Chuck Mayo

serialize/deserialize data
        39293 by: Brian V Bonini
        39317 by: Steve Werby
        39372 by: Ankur Verma

Re: To The Hacker: CodeBoy
        39294 by: Jonathan Sharp

security question
        39295 by: Marc Aragnou
        39296 by: Augusto Cesar Castoldi
        39369 by: Ankur Verma

How To Tell Which v. PHP?
        39297 by: Jeff Oien
        39298 by: Jason Murray
        39299 by: Brandon Orther
        39312 by: Maxim Maletsky
        39370 by: Ankur Verma

re:[PHP]Using PHP to process forms
        39300 by: Sean Kennedy
        39304 by: Philip Olson
        39305 by: Jeff Oien

checkboxes and arrays
        39301 by: Christian Dechery
        39320 by: Steve Werby

LOCK TABLES x COMMIT/ROLLBACK
        39302 by: Christian Dechery

Pay for help
        39303 by: rbradley

Reg. Exp. Help
        39306 by: Scott Mebberson
        39326 by: Scott Mebberson

Parse HTML Block
        39307 by: Mark Green
        39314 by: Thor M. Steindorsson

Re: echo vs print
        39308 by: Maxim Maletsky

Re: How to send email
        39309 by: Maxim Maletsky
        39360 by: Ankur Verma

create filesystem folder?
        39313 by: andrew
        39315 by: Philip Olson
        39371 by: Ankur Verma

session_register()
        39316 by: Peter Houchin

Using php as a shell scripting language
        39318 by: Tony Bibbs
        39324 by: Jason Brooke
        39325 by: David Robley

Newbie: Images refs not loading (Broken Icons) How to?
        39319 by: Malouin Design Graphique
        39321 by: Steve Werby
        39322 by: David Robley
        39328 by: Malouin Design Graphique
        39330 by: Steve Werby

help with classes
        39327 by: Joseph H Blythe
        39331 by: Joe Conway
        39335 by: Joseph H Blythe
        39337 by: Sean Cazzell
        39342 by: Joseph H Blythe
        39345 by: Joe Conway
        39349 by: Joseph H Blythe
        39373 by: Ankur Verma

mysql_fetch_array and row referencing under 4.0.4pl1
        39329 by: Scott Brown
        39332 by: Thomas Deliduka
        39333 by: Steve Werby
        39334 by: Steve Werby
        39341 by: Scott Brown
        39343 by: Scott Brown
        39350 by: Steve Werby

Re: new release : phpdoc v2.0
        39336 by: Christian Calloway
        39339 by: Christian Calloway

Build HREF list from database???
        39338 by: andrew
        39346 by: David Robley
        39348 by: andrew
        39374 by: Ankur Verma

Mail classes
        39340 by: Josh G
        39375 by: Ankur Verma

mktime + 4 days
        39344 by: Christopher Allen

Netscape6 with HTML Form using POST method
        39347 by: Yasuo Ohgaki

SELECT statement
        39351 by: Peter Houchin
        39352 by: Philip Olson
        39355 by: David Robley
        39357 by: Peter Houchin
        39359 by: Philip Olson
        39362 by: David Robley

Re: Run a script for 20minutes
        39353 by: Ankur Verma

Mathematical prob
        39354 by: Chris Aitken
        39358 by: Joe Conway
        39361 by: David Robley

Re: character problem
        39356 by: Ankur Verma

File Upload stuck in the midst
        39376 by: Dhaval Desai

Administrivia:

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

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

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


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


hello gurus, 

this is the first time, trying to solve a problem with this list. I
checked some of the archives, may be not all. So if that has been an
already asked question, please forgive. I also do not know anything
about the common "behaviour" on this list. 

But anyway : here is the problem: 

compiled apache (1.3.14) on a SuSe Linux - Box ..  starts and works with
plain setup. 
installed Oracle 8 client. installed php4.0.4.pl1, tested the thing with
plain php.  Get the correct results off the oracle DataBase.  

With httdp.conf 2 lines are added from the php make/make install : 

LoadModule php_module libexec/libphp4.so

and 

AddModule mod_php4.c 

the httpd server is not coming up does not give any log files. So i
assume httpd is dieing before he can get anywhere. 

any clues , every help appreciated. 


Mit freundlichen Grüßen 

G.Roland Sieger, CIT 

Email  : [EMAIL PROTECTED]
Phone : (49) 89 5110 413 
Fax     : (49) 89 5110 532

Postanschrift : 
Süd-Chemie AG 

Lenbachplatz 6 

80333 München 





on 2/12/01 1:01 PM, Jason Stechschulte at [EMAIL PROTECTED] wrote:

> On Mon, Feb 12, 2001 at 12:15:04PM -0500, Jesse Swensen wrote:
>> This should be a quick one, but I can't seem to wrap my brain around it.
>> All I need to do is replace leading or trailing spaces with underscores.  If
>> there is spaces in between words, leave them alone.
> 
> $fix = ereg_replace("(^ )|( $)", "_", $checkme);

This is very close.  If the string, "  Testing  ", had multiple spaces, but
I wanted to convert each space to a "_", then what?  I tried:

$fix = ereg_replace("(^ +)|( +$)", "_", $checkme);

and

$fix = ereg_replace("(^[ ]+)|([ ]+$)", "_", $checkme);

with no success.

Thanks for your help...
-- 
Jesse Swensen
[EMAIL PROTECTED]





> This is very close.  If the string, "  Testing  ", had multiple spaces, but
> I wanted to convert each space to a "_", then what?  I tried:

There may be a better way, but here is a lengthy one that works.

$checkme = "              this is          it               ";

if(ereg("^( )+", $checkme, $match)) {
   for($i = 0; $i < strlen($match[0]); $i++) {
      $start .= "_";
   }
}
if(ereg("( )+$", $checkme, $match)) {
   for($i = 0; $i < strlen($match[0]); $i++) {
      $end .= "_";
   }
}

$fix = ereg_replace("^( )+", $start, $checkme);
$fix = ereg_replace("( )+$", $end, $fix);

echo "$fix";

-- 
Jason Stechschulte
[EMAIL PROTECTED]
--
How do Crays and Alphas handle the POSIX problem?
             -- Larry Wall in <[EMAIL PROTECTED]>




On Monday 12 February 2001 21:08, Jesse Swensen wrote:
> >> This should be a quick one, but I can't seem to wrap my brain around
> >> it. All I need to do is replace leading or trailing spaces with
> >> underscores.  If there is spaces in between words, leave them alone.
> but I wanted to convert each space to a "_", then what?  I tried:
>
> $fix = ereg_replace("(^ +)|( +$)", "_", $checkme);
>
> and
>
> $fix = ereg_replace("(^[ ]+)|([ ]+$)", "_", $checkme);

preg_match ('/^(\s*)(.*?)(\s*)$/', $checkme, $matches);
$NewString = str_repeat ('_', strlen ($matches [1])).
        $matches [2] .
        str_repeat ('_', strlen ($matches [3]));

not tested, but should work fine.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]




on 2/12/01 4:30 PM, Christian Reiniger at [EMAIL PROTECTED] wrote:

> On Monday 12 February 2001 21:08, Jesse Swensen wrote:
>>>> This should be a quick one, but I can't seem to wrap my brain around
>>>> it. All I need to do is replace leading or trailing spaces with
>>>> underscores.  If there is spaces in between words, leave them alone.
>> but I wanted to convert each space to a "_", then what?  I tried:
>> 
>> $fix = ereg_replace("(^ +)|( +$)", "_", $checkme);
>> 
>> and
>> 
>> $fix = ereg_replace("(^[ ]+)|([ ]+$)", "_", $checkme);
> 
> preg_match ('/^(\s*)(.*?)(\s*)$/', $checkme, $matches);
> $NewString = str_repeat ('_', strlen ($matches [1])).
> $matches [2] .
> str_repeat ('_', strlen ($matches [3]));
> 
> not tested, but should work fine.

That worked.  Thank you very much.
-- 
Jesse Swensen
[EMAIL PROTECTED]





On Monday 12 February 2001 01:22, David Robley wrote:
> > while (!feof($file)) {
> >          $line = fgets($file, 255);
> >          if(eregi($oldemail, $line, $out)) {
> >                  str_replace($oldemail, $newemail, $line);
>
> You need to assign the output of this function to a string:
>                $new_line = str_replace($oldemail, $newemail, $line);

Another little thing: You don't need the eregi() here - just do 
str_replace. If it doesn't find $oldemail it won't do anything.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Nothing is more dangerous than an idea if it's the only one you have.

- Emil-Auguste Chartier, "Propos sur la religion", 1938




On Monday 12 February 2001 01:31, Scott Mebberson wrote:

> I understand that as of version 3.24, MySQL will support subselects.
> But untill then (because 3.23 is the latest stable release) I need to
> convert this SQL satement into something that can be used with v3.2? -
> the version just before the latest release.
>
> $search = "SELECT count(search_table.word) as score,
> search_table.qid,page_data.contents
>  FROM search_table,page_data
>  WHERE page_data.pID = search_table.qid AND search_table.word
>  IN($querywords)
>  GROUP BY search_table.qid
>  ORDER BY score DESC";

Uh, perhaps I'm blind and/or dumb, but I just can't find a subselect in 
that query.
The query as written here should run fine in any MySQL version

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Nothing is more dangerous than an idea if it's the only one you have.

- Emil-Auguste Chartier, "Propos sur la religion", 1938




I have the following code:

$arr_aantal = explode (",", $aantal);
$arr_str_men = explode (",", $str_men);
$arr_recht = explode (",", $recht);
$arr_rechtverstek = explode (",", $rechtverstek);
$arr_verstekgelijk = explode (",", $verstekgelijk);
$arr_verstekongelijk = explode (",", $verstekongelijk);

for($b=0; $b<$rows; $b+=1){
                $sql = "INSERT INTO " . $table_name . " SET aantal='" .
trim($arr_aantal[$b]) ."',str_men='" . trim($arr_str_men[$b]) ."',recht ='"
. trim($arr_recht[$b]) ."',rechtverstek='" . trim($arr_rechtverstek[$b])
."',verstekgelijk='" . trim($arr_verstekgelijk[$b]) ."',verstekongelijk='" .
trim($arr_verstekongelijk                       [$b]) . "', soorten=
'$bewaar'";

                mysql_query ($sql)
                 or die ("cannot execute update query");
}

if i do this the following sql statement is created,


INSERT INTO testen SET
aantal='22',str_men='2',recht='2',rechtverstek='2',verstekgelijk='2',verstek
ongelijk='2',soorten='plat3mm'
INSERT INTO testen SET
aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
jk='',soorten='plat3mm'
INSERT INTO testen SET
aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
jk='',soorten='plat3mm'
INSERT INTO testen SET
aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
jk='',soorten='plat3mm'
INSERT INTO testen SET
aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
jk='',soorten='plat3mm'
INSERT INTO testen SET
aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
jk='',soorten='plat3mm'
INSERT INTO testen SET
aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
jk='',soorten='plat3mm'


so the first array element goes wel, but the next contains no data, but i
know for sure that there is dat in it. See above.

Could anyone give me a clue?

aantal=$arr_aantal[$b]   should work i thaught.
or
 "aantal= ". $arr_aantal[$b] ." str_men=" . $arr_str_men[$b] . and so fort.









Hi Ramiro,

Your code looks ok, why don't you try the following and tell me is 
working or not

$arr_aantal = explode (",", $aantal);
$arr_str_men = explode (",", $str_men);
$arr_recht = explode (",", $recht);
$arr_rechtverstek = explode (",", $rechtverstek);
$arr_verstekgelijk = explode (",", $verstekgelijk);
$arr_verstekongelijk = explode (",", $verstekongelijk);
rows = count($arr_aantal);

for($b=0; $b<$rows; $b++):
  $sql = "INSERT INTO $table_name SET aantal='". trim($arr_aantal[$b]) ."',str_men='" 
. trim($arr_str_men[$b]) ."',recht ='"
.. trim($arr_recht[$b]) ."',rechtverstek='" . trim($arr_rechtverstek[$b])
.."',verstekgelijk='" . trim($arr_verstekgelijk[$b]) ."',verstekongelijk='" .
trim($arr_verstekongelijk                       [$b]) . "', soorten=
'$bewaar'";
      mysql_query ($sql)
                 or die ("cannot execute update query");
}

only change I made was to use the count from explode.


Ramiro Radjiman wrote:

> I have the following code:
> 
> $arr_aantal = explode (",", $aantal);
> $arr_str_men = explode (",", $str_men);
> $arr_recht = explode (",", $recht);
> $arr_rechtverstek = explode (",", $rechtverstek);
> $arr_verstekgelijk = explode (",", $verstekgelijk);
> $arr_verstekongelijk = explode (",", $verstekongelijk);
> 
> for($b=0; $b<$rows; $b+=1){
>                 $sql = "INSERT INTO " . $table_name . " SET aantal='" .
> trim($arr_aantal[$b]) ."',str_men='" . trim($arr_str_men[$b]) ."',recht ='"
> .. trim($arr_recht[$b]) ."',rechtverstek='" . trim($arr_rechtverstek[$b])
> .."',verstekgelijk='" . trim($arr_verstekgelijk[$b]) ."',verstekongelijk='" .
> trim($arr_verstekongelijk                       [$b]) . "', soorten=
> '$bewaar'";
> 
>                 mysql_query ($sql)
>                  or die ("cannot execute update query");
> }
> 
> if i do this the following sql statement is created,
> 
> 
> INSERT INTO testen SET
> aantal='22',str_men='2',recht='2',rechtverstek='2',verstekgelijk='2',verstek
> ongelijk='2',soorten='plat3mm'
> INSERT INTO testen SET
> aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
> jk='',soorten='plat3mm'
> INSERT INTO testen SET
> aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
> jk='',soorten='plat3mm'
> INSERT INTO testen SET
> aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
> jk='',soorten='plat3mm'
> INSERT INTO testen SET
> aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
> jk='',soorten='plat3mm'
> INSERT INTO testen SET
> aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
> jk='',soorten='plat3mm'
> INSERT INTO testen SET
> aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
> jk='',soorten='plat3mm'
> 
> 
> so the first array element goes wel, but the next contains no data, but i
> know for sure that there is dat in it. See above.
> 
> Could anyone give me a clue?
> 
> aantal=$arr_aantal[$b]   should work i thaught.
> or
>  "aantal= ". $arr_aantal[$b] ." str_men=" . $arr_str_men[$b] . and so fort.
> 
> 
> 
> 
> 
> 





Can anyone help?

Platform: Win2k, Apache, mysql

I am causing crashes when trying to run this date stuff using the PHP
module, but it works fine when using the same setup using the CGI version.

---- begin code snip ----
 
<SELECT name=\"OrdDate\" size\"1\">

        $max_date = 90;
        $ini_date = 0;
        echo("\t<OPTION VALUE=\"NULL\"> </OPTION>\n");
        do {
                $dis_date = date("D\. M\. d\, Y", strtotime ("+$ini_date
day"));
                $val_date = date("Y-m-d", strtotime ("+$ini_date day"));
                echo("\t<OPTION VALUE=\"'$val_date'\">[$ini_date]
$dis_date</OPTION>\n");
        }       while (++$ini_date <= $max_date);

</SELECT>

---- end code snip ----

thanks!

Charles Mulford
Web Developer
McLeodUSA




Hi list,
I have a csv text file that looks like this:

Mike,1,Monday 12th of February 2001 02:14:09 PM
Bob,3,Monday 12th of February 2001 02:14:17 PM
Marry,2,Monday 12th of February 2001 02:16:38 PM

I'm trying to get it to sort by the 2nd value (number
descending and to show only the top two highest
scores:
Like this..

Bob,3,Monday 12th of February 2001 02:14:17 PM
Marry,2,Monday 12th of February 2001 02:16:38 PM

This is what I have for code now:

// show high scores
        $lines = file("quiz.txt");
        sort($lines);
        for ($ i=0; $i < count ($lines); $i++){
                $thisline = explode(",", $lines[$i]);
                echo "<br>";
                for($j=0; $j < count($thisline);$j++)  { 
                         echo "$thisline[$j]" ;

                }

Is this possible to do?
I'm running linux with php3
Thank you
  --Mike

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/




Hrms.  Got a small problem.

I'm now using functions on a regular basis, but I've come to another
sticking point with them:  returning multiple variables from the function...

Here's a really quick example (nothing to do with what I intend to use the
functions for):

function CUP ($connection,$username,$password) {

    if (($username) && ($password)) {
        $sql = "SELECT username, password FROM table
            WHERE username = '$username' AND password = '$password'";
        $result = etc etc
        $num = mysql_numrows($result);

        if ($num != 0) {
            $valid = "yes";
        }

    return $valid;

}



$correct_user = CUP ($connection,$username,$password);

Now, if the user is correct, I'd get a return of

$correct_user = "yes";

What if I wanted to "return" more than one variable from the function?  And
how would I assign it a name?  Like the actual variable, or is that just not
possible?

I've tried
return $var1,$var2;
But got an error.

As always, tia :)

James.






On Mon, Feb 12, 2001 at 09:13:09PM -0000, James, Yz wrote:

> What if I wanted to "return" more than one variable from the function?  And
> how would I assign it a name?  Like the actual variable, or is that just not
> possible?
> 
> I've tried
> return $var1,$var2;

You're on the right track.

return Array($var1,$var2);

And when you call the function,

list($ret1,$ret2) = myfunc();  ..or..
$ret = myfunc();  ..and use $ret[0] and $ret[1]

Another option is to pass variables by reference.  For example, say you had
a function that returned true or false, but you wanted it to return an error
message with that false.  Something like this:

function test($condition,&$errormsg)
{
        if ($condition == $rightanswer)
        {
                return true;
        }
        else
        {
                $errormsg = "The condition wasn't the right answer.";
                return false;
        }
}

Then to check it,

if (!test('foo',$error))
        echo "Failed test!<br>Error: $errormsg<br>";

HTH,
Matt





An approach that many people take is to simply have a function return success
or failure, and have any data that needs to be propogated upwards assigned to
pass-by-reference parameters. I like this approach because it removes any
question as to what a function returns. One drawback is that it becomes
difficult to see where values are getting assigned when debugging.

i.e.:
function getMeTwoThings(&$first, &$second) {
        $first++;
        $second--;
        
        if ($first == $second) 
                return true;
        else
                return false;
}

Alternatively, you can return an array of values and use the list() construct to 
assign them.

i.e.:
function foobar() {
        return array($a, $b);
}

list($a, $b) = foobar();

John

On Mon, 12 Feb 2001, James, Yz wrote:

> Hrms.  Got a small problem.
> 
> I'm now using functions on a regular basis, but I've come to another
> sticking point with them:  returning multiple variables from the function...
> 
> Here's a really quick example (nothing to do with what I intend to use the
> functions for):
> 
> function CUP ($connection,$username,$password) {
> 
>     if (($username) && ($password)) {
>         $sql = "SELECT username, password FROM table
>             WHERE username = '$username' AND password = '$password'";
>         $result = etc etc
>         $num = mysql_numrows($result);
> 
>         if ($num != 0) {
>             $valid = "yes";
>         }
> 
>     return $valid;
> 
> }
> 
> 
> 
> $correct_user = CUP ($connection,$username,$password);
> 
> Now, if the user is correct, I'd get a return of
> 
> $correct_user = "yes";
> 
> What if I wanted to "return" more than one variable from the function?  And
> how would I assign it a name?  Like the actual variable, or is that just not
> possible?
> 
> I've tried
> return $var1,$var2;
> But got an error.
> 
> As always, tia :)
> 
> James.
> 
> 
> 
> 

-- 

John Donagher
Application Engineer
Intacct Corp. - Powerful Accounting on the Web
408-395-0989
720 University Ave.
Los Gatos CA 95032
www.intacct.com

Public key available off http://www.keyserver.net
Key fingerprint = 4024 DF50 56EE 19A3 258A  D628 22DE AD56 EEBE 8DDD





there are two ways of achieving this

1. Pass the arguments by reference and you will have their latest values
after the function call.

look up the manual http://www.php.net/manual/en/language.references.php

2. Create an array in the function with the various values to be returned
stored as its elements and then return the array. The array will then have
multiple return values in its elements after the function is called.

hope that helps

regards

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India


----- Original Message -----
From: "James, Yz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 2:43 AM
Subject: [PHP] returning multiple variables from a function?


> Hrms.  Got a small problem.
>
> I'm now using functions on a regular basis, but I've come to another
> sticking point with them:  returning multiple variables from the
function...
>
> Here's a really quick example (nothing to do with what I intend to use the
> functions for):
>
> function CUP ($connection,$username,$password) {
>
>     if (($username) && ($password)) {
>         $sql = "SELECT username, password FROM table
>             WHERE username = '$username' AND password = '$password'";
>         $result = etc etc
>         $num = mysql_numrows($result);
>
>         if ($num != 0) {
>             $valid = "yes";
>         }
>
>     return $valid;
>
> }
>
>
>
> $correct_user = CUP ($connection,$username,$password);
>
> Now, if the user is correct, I'd get a return of
>
> $correct_user = "yes";
>
> What if I wanted to "return" more than one variable from the function?
And
> how would I assign it a name?  Like the actual variable, or is that just
not
> possible?
>
> I've tried
> return $var1,$var2;
> But got an error.
>
> As always, tia :)
>
> James.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Hi All,

I've seen a couple of references to archiving files using exec() and tar or
zip. I am wondering, however, if this is the best/only way to do this. Is
this an inherently threaded process, so multiple simultaneous requests won't
seriously compromise server performance? What other gotchas should I be
aware of?

I'm sure that others have researched automatic archiving of files on
servers, and I'd really appreciate hearing about your experiences.

Thanks,

michael geary




I've never done what you are saaying, but if I would have to, I would then
create a file with an exec() (in case there's nothing like that within PHP
build-in functions) and would run it from cron automatically.

Cheers,
Maxim Maletsky




-----Original Message-----
From: Michael Geary [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 6:11 AM
To: [EMAIL PROTECTED]
Subject: [PHP] (g)Zip archiving of local files?


Hi All,

I've seen a couple of references to archiving files using exec() and tar or
zip. I am wondering, however, if this is the best/only way to do this. Is
this an inherently threaded process, so multiple simultaneous requests won't
seriously compromise server performance? What other gotchas should I be
aware of?

I'm sure that others have researched automatic archiving of files on
servers, and I'd really appreciate hearing about your experiences.

Thanks,

michael geary

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




On Monday 12 February 2001 11:34, Michael Hall wrote:
> this works fine except that 14.95 * 2 comes out as 29.9 not 29.90. In
> other words, how to add a zero so that there are always two decimal
> places. Any solution to this, including regex? I can't find anything

look for number_format() and sprintf ()

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]




I am trying to process a form using text/html and mail().

The resulting email continues to have an ! inserted randomly
into the email.  Does anyone know how to avoid this??

__________________________________
Lorenzo Curtis
Website/Database Developer
prexar - internet and beyond
[EMAIL PROTECTED]
(207) 974-4334




On Monday 12 February 2001 22:27, Curtis, Lorenzo wrote:
> I am trying to process a form using text/html and mail().
>
> The resulting email continues to have an ! inserted randomly
> into the email.  Does anyone know how to avoid this??

Yes. Look through your code and find out where you're inserting that "!".
Such things don't get in by accident - it's a bug in your code.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]




I don't think it's a bug in my code... I have gone through it
dozens of times and there are NO exclamation points...





__________________________________
Lorenzo Curtis
Website/Database Developer
prexar - internet and beyond
[EMAIL PROTECTED]
(207) 974-4334


-----Original Message-----
From: Christian Reiniger [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 12, 2001 4:42 PM
To: PHP List
Subject: Re: [PHP] Problems with ! in mail();


On Monday 12 February 2001 22:27, Curtis, Lorenzo wrote:
> I am trying to process a form using text/html and mail().
>
> The resulting email continues to have an ! inserted randomly
> into the email.  Does anyone know how to avoid this??

Yes. Look through your code and find out where you're inserting that "!".
Such things don't get in by accident - it's a bug in your code.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




On Monday 12 February 2001 23:00, Curtis, Lorenzo wrote:
> I don't think it's a bug in my code... I have gone through it
> dozens of times and there are NO exclamation points...

Well, somewhere it has to come from, and PHP doesn't have an "insert 
stuff into mails randomly" festure...

> On Monday 12 February 2001 22:27, Curtis, Lorenzo wrote:
> > I am trying to process a form using text/html and mail().
> >
> > The resulting email continues to have an ! inserted randomly
> > into the email.  Does anyone know how to avoid this??
>
> Yes. Look through your code and find out where you're inserting that
> "!". Such things don't get in by accident - it's a bug in your code.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]




In article 
<[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] ("Curtis, Lorenzo") wrote:

> I don't think it's a bug in my code... I have gone through it
> dozens of times and there are NO exclamation points...

It may be in a variable or constant.  Try doing a var_dump()  or echo() on 
each.  If you're still not finding it, you can post the relevant code here 
for someone else to take a look.

-- 
CC




let's see some code

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India

----- Original Message ----- 
From: "Curtis, Lorenzo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "PHP List" <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 3:30 AM
Subject: RE: [PHP] Problems with ! in mail();


> I don't think it's a bug in my code... I have gone through it
> dozens of times and there are NO exclamation points...
> 
> 
> 
> 
> 
> __________________________________
> Lorenzo Curtis
> Website/Database Developer
> prexar - internet and beyond
> [EMAIL PROTECTED]
> (207) 974-4334
> 
> 
> -----Original Message-----
> From: Christian Reiniger [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 12, 2001 4:42 PM
> To: PHP List
> Subject: Re: [PHP] Problems with ! in mail();
> 
> 
> On Monday 12 February 2001 22:27, Curtis, Lorenzo wrote:
> > I am trying to process a form using text/html and mail().
> >
> > The resulting email continues to have an ! inserted randomly
> > into the email.  Does anyone know how to avoid this??
> 
> Yes. Look through your code and find out where you're inserting that "!".
> Such things don't get in by accident - it's a bug in your code.
> 
> -- 
> Christian Reiniger
> LGDC Webmaster (http://sunsite.dk/lgdc/)
> 
> Those who will not reason, are bigots,
> those who cannot, are fools,
> and those who dare not, are slaves.
> 
> - George Gordon Noel Byron (1788-1824), [Lord Byron]
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Hello,

My problem is that I have in the table below an URL (see $indice_url)
that points to the graphic (.gif) that has to be use by the the
"$indice" variable. The graphics ( five different ones) located in
the same folder as the script " data_out.php3"

Any Guru out here could shred me the "Blue Light" on how to make the
images to show?

Thanks in advance,

Best regards,

Yves



This is the table that feeds:
--------------------------------
CREATE TABLE indice (
    id int(11) DEFAULT '0' NOT NULL auto_increment,
    date text,
    indice text,
    indice_url varchar(255),
    PRIMARY KEY (id)
);
--------------------------------


The file to get the data out:
--------------------------------
<?php

/* data_out.php3 */

$db = mysql_connect("www.server.com", "root", "password");
mysql_select_db("db_name", $db);
$sql = "select * from table_name order by 'date'";
$sql = "select * from table_name";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
print("<tr><td bgcolor=\"#003399\">");
printf("<img src=\"$indice_url\">%s</td></tr>\n",
$row["indice_url"]);
}
?>
--------------------------------


The output that it gives me (in source mode):
--------------------------------
  <table border="1" cellpadding="3" width="130">
        <tr><td bgcolor="#003399"><img src="">image_f03.gif</td></tr>
        <tr><td bgcolor="#003399"><img src="">image_f05.gif</td></tr>
        <tr><td bgcolor="#003399"><img src="">image_f01.gif</td></tr>
</table>
--------------------------------
--


------------------------
Malouin Design Graphique
http://www.malouin.qc.ca

Québec (Québec)  CANADA





I am doing the same with the following code

$rec1=@mysql_fetch_object($result);
$image=$rec1->iurl;
$alt=$rec->mnam;
$array=GetImageSize("image/$image");
echo "<img src='image/$image' alt=$alt border=0 align=left $array[2]>";

and it works  a charm.



Malouin Design Graphique wrote:

> Hello,
> 
> My problem is that I have in the table below an URL (see $indice_url)
> that points to the graphic (.gif) that has to be use by the the
> "$indice" variable. The graphics ( five different ones) located in
> the same folder as the script " data_out.php3"
> 
> Any Guru out here could shred me the "Blue Light" on how to make the
> images to show?
> 
> Thanks in advance,
> 
> Best regards,
> 
> Yves
> 
> 
> 
> This is the table that feeds:
> --------------------------------
> CREATE TABLE indice (
>    id int(11) DEFAULT '0' NOT NULL auto_increment,
>    date text,
>    indice text,
>    indice_url varchar(255),
>    PRIMARY KEY (id)
> );
> --------------------------------
> 
> 
> The file to get the data out:
> --------------------------------
> <?php
> 
> /* data_out.php3 */
> 
> $db = mysql_connect("www.server.com", "root", "password");
> mysql_select_db("db_name", $db);
> $sql = "select * from table_name order by 'date'";
> $sql = "select * from table_name";
> $result = mysql_query($sql);
> while ($row = mysql_fetch_array($result)) {
> print("<tr><td bgcolor=\"#003399\">");
> printf("<img src=\"$indice_url\">%s</td></tr>\n",
> $row["indice_url"]);
> }
> ?>
> --------------------------------
> 
> 
> The output that it gives me (in source mode):
> --------------------------------
>  <table border="1" cellpadding="3" width="130">
>     <tr><td bgcolor="#003399"><img src="">image_f03.gif</td></tr>
>     <tr><td bgcolor="#003399"><img src="">image_f05.gif</td></tr>
>     <tr><td bgcolor="#003399"><img src="">image_f01.gif</td></tr>
> </table>
> --------------------------------






try this

printf("<img
src=\"%s\">%s</td></tr>\n",$row["indice_url"],$row["indice_url"]);

regards

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India

----- Original Message -----
From: "Malouin Design Graphique" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 3:05 AM
Subject: [PHP] Broken icon?


> Hello,
>
> My problem is that I have in the table below an URL (see $indice_url)
> that points to the graphic (.gif) that has to be use by the the
> "$indice" variable. The graphics ( five different ones) located in
> the same folder as the script " data_out.php3"
>
> Any Guru out here could shred me the "Blue Light" on how to make the
> images to show?
>
> Thanks in advance,
>
> Best regards,
>
> Yves
>
>
>
> This is the table that feeds:
> --------------------------------
> CREATE TABLE indice (
>     id int(11) DEFAULT '0' NOT NULL auto_increment,
>     date text,
>     indice text,
>     indice_url varchar(255),
>     PRIMARY KEY (id)
> );
> --------------------------------
>
>
> The file to get the data out:
> --------------------------------
> <?php
>
> /* data_out.php3 */
>
> $db = mysql_connect("www.server.com", "root", "password");
> mysql_select_db("db_name", $db);
> $sql = "select * from table_name order by 'date'";
> $sql = "select * from table_name";
> $result = mysql_query($sql);
> while ($row = mysql_fetch_array($result)) {
> print("<tr><td bgcolor=\"#003399\">");
> printf("<img src=\"$indice_url\">%s</td></tr>\n",
> $row["indice_url"]);
> }
> ?>
> --------------------------------
>
>
> The output that it gives me (in source mode):
> --------------------------------
>   <table border="1" cellpadding="3" width="130">
> <tr><td bgcolor="#003399"><img src="">image_f03.gif</td></tr>
> <tr><td bgcolor="#003399"><img src="">image_f05.gif</td></tr>
> <tr><td bgcolor="#003399"><img src="">image_f01.gif</td></tr>
> </table>
> --------------------------------
> --
>
>
> ------------------------
> Malouin Design Graphique
> http://www.malouin.qc.ca
>
> Québec (Québec)  CANADA
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





On Monday 12 February 2001 10:41, PHPBeginner.com wrote:

>   I'm having a rather strange problem.  I'm trying to compare two
> values. "01" and "1".  The variables names that they are submitted
> under are pick1 and pick2.   i use the following code

[...]

> I still get the error.  Anyone have any ideas?  These two valuse mustbe
> evaluated as different.

if (strcmp ($pick1, $pick2) == 0)
  echo "equal";
else
  echo "different";

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]




Does anyone have examples of using PHP to process forms?  I'd also like
to know if I can embed the code in my html file or do I have to write a
CGI server side script to do it?

Thanks,
Don





These are really basic functions of PHP and you should probably start out
with some of the beginner tutorials found on php.net

--Joe

On Mon, Feb 12, 2001 at 04:54:30PM -0500, Don wrote:
> Does anyone have examples of using PHP to process forms?  I'd also like
> to know if I can embed the code in my html file or do I have to write a
> CGI server side script to do it?
> 
> Thanks,
> Don
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 

-------------------------------------------------------------------------------
Joe Stump, PHP Hacker, [EMAIL PROTECTED]                                 -o)
http://www.miester.org http://www.care2.com                                 /\\
"It's not enough to succeed. Everyone else must fail" -- Larry Ellison     _\_V
-------------------------------------------------------------------------------





hm...  dunno how to answer .. 

Yes you can process forms, 
and you don't necessarily need any CGI to do that...


you know what?...  Search on Goolge how to do it, or download and install
some relatively light PHP software and try to see it "deep inside"

Cheers,
Maxim Maletsky



-----Original Message-----
From: Don [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 6:55 AM
To: php list
Subject: [PHP] Using PHP to process forms


Does anyone have examples of using PHP to process forms?  I'd also like
to know if I can embed the code in my html file or do I have to write a
CGI server side script to do it?

Thanks,
Don


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




you can get a very good tutorials to start up with php at www.devshed.com
and http://www.webmonkey.com

take a look at them to start up with php.

you can embed the php code in your HTML file and need not write a cgi script
to do so. I am sure these tutorials will get you up and running and clear
most of your doubts.

regards

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India

----- Original Message -----
From: "Don" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 3:24 AM
Subject: [PHP] Using PHP to process forms


> Does anyone have examples of using PHP to process forms?  I'd also like
> to know if I can embed the code in my html file or do I have to write a
> CGI server side script to do it?
>
> Thanks,
> Don
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]







-----Original Message-----
From:   Steve Haemelinck [mailto:[EMAIL PROTECTED]]
Sent:   maandag 12 februari 2001 21:52
To:     'Steve Haemelinck'
Subject:        RE: [PHP] XML Parsing The Sequel II

Ok, I solved the problems with my proxy, I can get the xml but I can not get
it completely.
Why?  Because I am not able to open the tags and that is why it stops at the
first one.
Does anyone has an idea how I can open the tags ?
This is my code so far :)
function GetXMLData($xmlFile_Location){
# Proxy Settings
$proxy_ip="proxy.server.be";
$proxy_port€80;

/* Get the required data from Nasdaq */
$sockPointer = fsockopen($proxy_ip,$proxy_port, $errNo, $errStr,30);
//Connect to Proxy
if( !$sockPointer ){
echo "$errStr Proxy not Available \n \n";
exit();
    }
   else{
fputs($sockPointer,"GET $xmlFile_Location / HTTP/1.0\n\n");
while (!feof($sockPointer)){
$Data .= fgets($sockPointer, 1000);
        }
    }

/* Store the locally for Parsing */
SaveDataLocally($Data, ".xml");
}

-----Original Message-----
From:   Steve Haemelinck [mailto:[EMAIL PROTECTED]]
Sent:   maandag 12 februari 2001 20:42
To:     'Steve Haemelinck'
Cc:     PHP Mailing Listl (E-mail)
Subject:        RE: [PHP] XML Parsing The Sequel II

I think I found the problem.
Because I am behind a proxy I can not connect to http://quotes.nasdaq.com.
And get the data !!!

-----Original Message-----
From:   Steve Haemelinck [mailto:[EMAIL PROTECTED]]
Sent:   zondag 11 februari 2001 11:13
To:     PHP Mailing Listl (E-mail)
Subject:        [PHP] XML Parsing The Sequel II

Ok, yesterday I had problems parsing an XML from Nasdaq.  Thx to Matt these
problems have been solved and I am know able to parse any XML without
problems (I hope).
But I have one question:
In order to parse an XML you have to tell your parser where to find the
document:
$xml_file = "test.xml';
This works perfectly, but If you want to get the XML files from Nasdaq you
have to say
$xml_file =
http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock&symbol=NETA;
This however doe not work !!!
Why?  How can I overcome this problem?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]







When a form is submitted from an image (e.g. <input src="../images/next1.gif" 
name="paging" type="image" value="pageforward"> ) this will be passed in the 
URL as paging.x=SOME_NUMBER.
If I try and access this variable as ${paging.x} in the subsequent PHP script 
I get nothing.
How can I access this variable? all I want to do is test for it's existance ?
Simple as it seems ... it doesn't work ?

-----------------------
Flowers2send - your guarantee to success on Valentines Day!!!
Visit www.flowers2send.com or phone 0845 1200 430





> When a form is submitted from an image (e.g. <input src="../images
> /next1.gif" name="paging" type="image" value="pageforward"> ) this 
> will be passed in the URL as paging.x=SOME_NUMBER. If I try and 
> access this variable as ${paging.x} in the subsequent PHP script 
> I get nothing. How can I access this variable? all I want to do 
> is test for it's existance ? Simple as it seems ... it doesn't 
> work ?

You can't use a "." in a variable name. PHP automagically converts 
it into a "_". So, look for $paging_x.

Jason




Hi,

I'm sending a form, with check-boxes, via post to PHP-script and if the
boxes are not checked they don't post value for its variable - Can I check
with a function if the variable is defined? (or should I focus on another
solution?)

Regards,
Sumarlidi Einar Dadason

SED - Graphic Design

------------------------------------------
Phone:       (+354) 4615501
Mobile:      (+354) 8960376
Fax:         (+354) 4615503
E-mail:      [EMAIL PROTECTED]
Homepage:    www.sed.is <- New Homepage!
------------------------------------------





On Mon, Feb 12, 2001 at 11:21:45PM -0000, SED wrote:

> I'm sending a form, with check-boxes, via post to PHP-script and if the
> boxes are not checked they don't post value for its variable - Can I check
> with a function if the variable is defined? (or should I focus on another
> solution?)

php.net/isset

-Egon

-- 
http://www.linuxtag.de/
http://php.net/books.php 
http://www.concert-band.de/
http://www.php-buch.de/




try:
isset($var);
return true is variable is set, false otherwise. Check www.php.net for more 
info.

Reuben D. B


At 11:21 PM 2/12/01 +0000, SED wrote:
>Hi,
>
>I'm sending a form, with check-boxes, via post to PHP-script and if the
>boxes are not checked they don't post value for its variable - Can I check
>with a function if the variable is defined? (or should I focus on another
>solution?)
>
>Regards,
>Sumarlidi Einar Dadason
>
>SED - Graphic Design
>
>------------------------------------------
>Phone:       (+354) 4615501
>Mobile:      (+354) 8960376
>Fax:         (+354) 4615503
>E-mail:      [EMAIL PROTECTED]
>Homepage:    www.sed.is <- New Homepage!
>------------------------------------------
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]





if (isset($var))

> -----Original Message-----
> From: SED [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 12, 2001 6:22 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] How to check if vaiable is defined or not?
>
>
> Hi,
>
> I'm sending a form, with check-boxes, via post to PHP-script and if the
> boxes are not checked they don't post value for its variable - Can I check
> with a function if the variable is defined? (or should I focus on another
> solution?)
>
> Regards,
> Sumarlidi Einar Dadason
>
> SED - Graphic Design
>
> ------------------------------------------
> Phone:       (+354) 4615501
> Mobile:      (+354) 8960376
> Fax:         (+354) 4615503
> E-mail:      [EMAIL PROTECTED]
> Homepage:    www.sed.is <- New Homepage!
> ------------------------------------------
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>





try using

isset() or empty()

see the php manual for more details

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India

----- Original Message -----
From: "SED" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 4:51 AM
Subject: [PHP] How to check if vaiable is defined or not?


> Hi,
>
> I'm sending a form, with check-boxes, via post to PHP-script and if the
> boxes are not checked they don't post value for its variable - Can I check
> with a function if the variable is defined? (or should I focus on another
> solution?)
>
> Regards,
> Sumarlidi Einar Dadason
>
> SED - Graphic Design
>
> ------------------------------------------
> Phone:       (+354) 4615501
> Mobile:      (+354) 8960376
> Fax:         (+354) 4615503
> E-mail:      [EMAIL PROTECTED]
> Homepage:    www.sed.is <- New Homepage!
> ------------------------------------------
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





I'm really struggling configuring the php mod with oracle 8i support on
Solaris 8.

./configure --enable-track-vars --with-o8ci=/export/home/oracle
--with-oracle --enable-sigchild --with-apxs

The ORACLE_HOME is set to /export/home/oracle.

I am getting an error:

checking Oracle Install-Dir...
+--------------------------------------------------------------------+
| Notice:                                                            |
| If you encounter <defunc> processes when using a local Oracle-DB   |
| please recompile PHP and specify --enable-sigchild when configuring|
| (This problem has been reported un Linux using Oracle >= 8.1.5)    |
+--------------------------------------------------------------------+
checking Oracle version... configure: error: Oracle needed libraries not found

I installed the oracle 8i client prior to compiling. I've installed all
the compilers, Please God, WHAT HAVE I DONE WRONG.....  If anyone out
there can help this poor wrech of a man. Please help me......



-- 
Richard Bradley
CTO YourLink, inc.
(321) 452-6699
IM lagoonr




> I'm really struggling configuring the php mod with oracle 8i support on
> Solaris 8.
>
> ./configure --enable-track-vars --with-o8ci=/export/home/oracle
> --with-oracle --enable-sigchild --with-apxs
>
> The ORACLE_HOME is set to /export/home/oracle.
>
> I am getting an error:
>
> checking Oracle Install-Dir...
> +--------------------------------------------------------------------+
> | Notice:                                                            |
> | If you encounter <defunc> processes when using a local Oracle-DB   |
> | please recompile PHP and specify --enable-sigchild when configuring|
> | (This problem has been reported un Linux using Oracle >= 8.1.5)    |
> +--------------------------------------------------------------------+
> checking Oracle version... configure: error: Oracle needed libraries not
found
>
> I installed the oracle 8i client prior to compiling. I've installed all
> the compilers, Please God, WHAT HAVE I DONE WRONG.....  If anyone out
> there can help this poor wrech of a man. Please help me......

Richard,

Below is a copy of my reply to someone else on this topic from last June (so
I'm not entirely sure the -lpthread part still applies). It sounds like the
error message might be related to the LD_LIBRARY_PATH envoronment setting.
Alternatively, I think you can edit /etc/ld.so.conf to add a line pointing
to your $ORACLE_HOME/lib, and then run ldconfig.

Hope this helps,

Joe

<old email>
I had a similar problem which took two actions to solve it. First, recompile
apache after adding
    "-lpthread" (without the quotes)
to the LIBS1 line in the makefile. Apparently this is related to a known
glibc bug and the fact that the oracle client library is threaded.
Alternatively you can add
    "LIBS=-lpthread \" (no quotes)
just before OPTIM="$RPM_OPT_FLAGS" \ in the apache.spec file if you want to
work from an RPM source file (this is what I did).

The second thing to check is that you have LD_LIBRARY_PATH=$ORACLE_HOME/lib
defined in your environment.

Hope this helps.

Joe
</old email>







Hi all,
 
I've created a page (see attached file) everything works fine in IE but once i check it in NN i get nothing showing up, when i view the source code of the page i can see the full code can any one offer me any suggestions as to why this is so...( I have check all HTML and its all correct and working in NN when its taken out of the php script)
 
Thanks
 
Peter




> I've created a page (see attached file) everything works fine 
> in IE but once i check it in NN i get nothing showing up, when 
> i view the source code of the page i can see the full code can 
> any one offer me any suggestions as to why this is so...( I have 
> check all HTML and its all correct and working in NN when its 
> taken out of the php script)

You can't attach files on the mailing list, but I'd bet good money
that you've forgotten a </TABLE> somewhere important. Chuck in a
</TABLE> before </BODY> and see what happens.

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Design Team, Melbourne IT
Fetch the comfy chair!




"Peter Houchin" <[EMAIL PROTECTED]> wrote:
> I've created a page (see attached file)

Oops!  I believe attachments are blocked from this list.  Send inline or
post a URL where we can look.

> everything works fine in IE but once
> i check it in NN i get nothing showing up, when i view the source code of
> the page i can see the full code

You mean full "HTML" code, not full "PHP" code, right?

> can any one offer me any suggestions as to
> why this is so...( I have check all HTML and its all correct and working
in
> NN when its taken out of the php script)

I'd need to see the code to speculate.  My first thought would be broken
HTML since IE will display bad HTML that Netscape won't, but you've ruled
that out.  There are other possibilities, including Netscape not handling
$PHP_SELF right in a form on the index page of a directory and some other
possibilities, but without the code...

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/





check for your closing table tags </table>

Netscape is not at all forgiving for tables which are not closed.

hope that helps

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India

  ----- Original Message ----- 
  From: Peter Houchin 
  To: [EMAIL PROTECTED] 
  Sent: Tuesday, February 13, 2001 4:58 AM
  Subject: [PHP] Nothing Showling up in Netscape


  Hi all,
   
  I've created a page (see attached file) everything works fine in IE but once i check 
it in NN i get nothing showing up, when i view the source code of the page i can see 
the full code can any one offer me any suggestions as to why this is so...( I have 
check all HTML and its all correct and working in NN when its taken out of the php 
script)
   
  Thanks 
   
  Peter


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


  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]




Sounds like just what I need. Thanks, Ankur & Maxim.

Ankur Verma wrote:

> try using session variables.
>
> take a look at phplib if you are using PHP3 or
>
> http://www.php.net/manual/en/ref.session.php
>
> if you are using PHP4
>
> hope that helps
>
> Ankur Verma
> HCL Technologies
> A1CD, Sec -16
> Noida, UP
> India
>
> ----- Original Message -----
> From: "Chuck Mayo" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, February 12, 2001 10:53 AM
> Subject: [PHP] Preserve variables between page loads?
>
> > This may have crossed the list a bazillion times, but I couldn't
> really
> find
> > anything appropriate in the archives... maybe I just didn't look hard
> enough.
> >
> > In a MySQL app, I have the usual row of paging links at the bottom of
> the
> page
> > and need to pass to the next iteration more variables than I can
> comfortably
> > url-encode in the hyperlink. If all these paging links were submit
> buttons
> I
> > could pass anything I wanted in hidden form fields, but since they're
> > hyperlinks I don't seem to have that option.
> >
> > Is there a way to selectively preserve variables between iterations?
> Something
> > like variables that are global to PHP, as opposed to being global
> within
> the
> > script?
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





What exactly does
serialize/deserialize data
mean?




"Brian V Bonini" <[EMAIL PROTECTED]> wrote:
> What exactly does
> serialize/deserialize data
> mean?

See the manual at http://www.php.net/manual/en/function.serialize.php.
Serializing is a way of storing values so that they retain their type and
structure.  Session variables are stored in this way.  Here's a serialized
set of session variables from an intranet application I wrote:

employee_id|s:4:"7204";logged_in|i:1;name_l|s:7:"Edmonds";name_f|s:5:"Larry"
;component_id|a:5:{i:0;s:4:"1001";i:1;s:4:"1002";i:2;s:4:"1003";i:3;s:4:"100
4";i:4;s:7:"1002101";}

unserialize( $var_name ) will pull transform the values back into their
normal state.

If you want to pass form data from page to page (arrays in particular),
store an array in a single field of a database or store values and retain
the fact that they're an integers, strings, etc. serialize is a good way to
accomplish this.  I hope that helped clarify serialize a little.  If not,
just play with it a little to understand it.

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/





what serialize does is that it allows you to store or pass data types such
as arrays, objects etc without losing their structure.

for ex, let's say you have an array

$foo=array("abc","def")

now you need to pass this array to the next page without losing the
structure. that is on the next page, you shoudl be able to do $foo[0] and
till be able to get

$foo[0] as "abc"

just do the folloowing

$passFoo=serialzie($foo);

and pass the value in $passFoo to the next page

on the next page, you should do

$foo=unserialzie($passFoo)

and doing $foo[0] should give you "abc"

try it out yourself writing some dummy code and you will understand it
better.

serialize is extremely helpful in case of storing session variables, arrrays
etc.

hope that helps

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India


----- Original Message -----
From: "Brian V Bonini" <[EMAIL PROTECTED]>
To: "PHP Lists" <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 5:36 AM
Subject: [PHP] serialize/deserialize data


> What exactly does
> serialize/deserialize data
> mean?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





rswfire,
This thread does not pertain to the php-general list anymore, nor was your
origional post. I personally emailed you OFF list and your reply was ON list
which didn't have any business with this anymore. This situation is between
you and me and i am happy to discuss anything which you would like. But
posting to the list and calling me a "hacker" is in appropriate. As well as
some of the allegations that "You did this day after day for almost five
days, sir." that is incorrect, i logged in that one friday night.

Thank you,
-Jonathan Sharp


> -----Original Message-----
> From: rswfire [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, February 11, 2001 3:52 PM
> To: Jonathan Sharp
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] To The Hacker: CodeBoy
>
>
> Jonathon,
>
> I apologize for making a big deal out of this.
> But to me, this is a big deal.  I found your
> actions very threatening.  And even days later I
> have actually lost sleep over it and been in a
> relatively bad mood because of it.
>
> Furthermore, below you stated I posted a URL.
> That URL was to a geocities.com site.  That site
> has nothing to do with PHP and has nothing to do
> with my local computer.  In fact, that
> geocities.com site only showed screenshots of
> what I had been working on.  Obviously, it must
> have sparked your interest because you went to
> work on finding out my IP Address so that you
> could break into my system.
>
> I am not a hacker.  I do not try to hack and
> don't know how people go about doing it.  I'm a
> programmer.  To me, those two are very different.
>  A programmer is constructive.  A programmer
> likes to take a problem and turn it into a
> solution.  A programmer is creative.  A
> programmer has respect for other people's domains
> and boundaries.  A hacker is destructuve.  A
> hacker takes a solution and turns it into a
> problem.  A hacker has no respect for other
> people's domain or boundaries.  As you have
> clearly done.  You have overstepped a boundary
> with me.
>
> I did not know someone would come snooping up my
> IP Address to break into my site.  I did not know
> it was even possible.  The need to go into my
> database and add your username, etc. was uncalled
> for.  Furthermore, you did not stop there.  You
> also went into my FTP site (which was empty) and
> my SMTP server (which was empty) adding folders,
> etc.  I have full logs of your activity.  You did
> this day after day for almost five days, sir.  I
> find that uncalled for.
>
> If you have copies of any of my files I suggest
> you delete them immediately.  I have Intellectual
> Property rights to these files and will prosecute
> you if I find out you have used them to any
> means.
>
> Again, I'm sorry for making a big deal out of
> this.  But it is a big deal.  You have threatened
> me in a very personal way.
>
> End of Thread.
>
>
>
> --- Jonathan Sharp <[EMAIL PROTECTED]> wrote:
> > Ok, I just checked my mail and found this
> > thread... to clear this up...
> >
> > In one of your posts you posed a url to a
> > script you were working on...and I
> > backed up a directory and it gave me a
> > directory listing...one folder was
> > /admin/ it gave another listing...then showed
> > phpMyAdmin and then it gave
> > your full db schema...no passwords or
> > anything...i was able to insert a
> > record...and a user to your mysql server...
> > password is (abc123) that's all
> > i did...nothing else...and i'd hardly consider
> > that a hack...more of a
> > "browse"
> >
> > Cheers,
> > -Jonathan
> > aka: "Codeboy the *dangerous* hacker"
> >
> > > -----Original Message-----
> > > From: Philip Olson
> > [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, February 08, 2001 4:24 PM
> > > To: James, Yz
> > > Cc: [EMAIL PROTECTED]
> > > Subject: Re: [PHP] To The Hacker: CodeBoy
> > >
> > >
> > > > True, but none of which are applicable to
> > me, as I've not
> > > slandered, defamed
> > > > or spoofed anything or anyone.  As far as
> > hacking is concerned,
> > > I wouldn't
> > > > know my arse from my elbow :)
> > >
> > > just a fyi, my post had nothing to do with
> > you.  or the other james (which
> > > that line you're referring too had to do
> > with) but rather, that of the
> > > person in question ("hacker").  but anyway,
> > let's let this thread die.
> > > it's time.
> > >
> > > Philip
> > >
> > >
> > > --
> > > PHP General Mailing List
> > (http://www.php.net/)
> > > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail:
> > [EMAIL PROTECTED]
> > >
> > >
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
> > [EMAIL PROTECTED]
> >
>
>
> =====
> =====================================
>              [ rswfire ]
>
>   http://rswfire.swifte.net/
>   http://profiles.yahoo.com/rswfire
>
> =====================================
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year!  http://personal.mail.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
>





Hello there,

I'm posting a username and a password with:

<input type="hidden" name="username" value="<?php echo $username ?>">
<input type="hidden" name="password" value="<?php echo $password ?>">

When I check $HTTP_POST_VARS I can see the values as they're plain text. Is
this still safe to do or should I encrypt the strings before posting them
between pages?

Thanks for your help.

-----Original Message-----
From: Brian V Bonini [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 13 February 2001 11:07 AM
To: PHP Lists
Subject: [PHP] serialize/deserialize data


What exactly does
serialize/deserialize data
mean?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






I think you should encrypt (crypt).

On Tue, 13 Feb 2001, Marc Aragnou wrote:

> Hello there,
> 
> I'm posting a username and a password with:
> 
> <input type="hidden" name="username" value="<?php echo $username ?>">
> <input type="hidden" name="password" value="<?php echo $password ?>">
> 
> When I check $HTTP_POST_VARS I can see the values as they're plain text. Is
> this still safe to do or should I encrypt the strings before posting them
> between pages?
> 
> Thanks for your help.
> 
> -----Original Message-----
> From: Brian V Bonini [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 13 February 2001 11:07 AM
> To: PHP Lists
> Subject: [PHP] serialize/deserialize data
> 
> 
> What exactly does
> serialize/deserialize data
> mean?
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





if you are using these values to check for user login across multpile pages
on your site (i.e you want the user to login at one place and you are
passing the login info to all the other pages on the site using the hidden
fields ) you should take a look at the concept of user sessions

take a look at the phplib session management, tutorials on sessions at
www.phpbuilder.com (I am not very sure bnut I recall they had one) and the
session functions in the php manual.

hope that helps

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India

----- Original Message -----
From: "Marc Aragnou" <[EMAIL PROTECTED]>
To: "PHP Lists" <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 6:00 AM
Subject: [PHP] security question


> Hello there,
>
> I'm posting a username and a password with:
>
> <input type="hidden" name="username" value="<?php echo $username ?>">
> <input type="hidden" name="password" value="<?php echo $password ?>">
>
> When I check $HTTP_POST_VARS I can see the values as they're plain text.
Is
> this still safe to do or should I encrypt the strings before posting them
> between pages?
>
> Thanks for your help.
>
> -----Original Message-----
> From: Brian V Bonini [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 13 February 2001 11:07 AM
> To: PHP Lists
> Subject: [PHP] serialize/deserialize data
>
>
> What exactly does
> serialize/deserialize data
> mean?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Is there a script I can run to tell which version of PHP the
server is using to run it?

Details:
Two reasons I ask. One is if I have a client on an unfamiliar
server with bad or no documentation. Or to test when using 
.htaccess to use the .phtml extension for php3 when the server
would normally see that as a PHP2 file. 

Thanks.
Jeff Oien 




> Is there a script I can run to tell which version of PHP the
> server is using to run it?

http://uptime.netcraft.com/up/graph/

Enter the URL under "what's that site running?", and assuming PHP
has not been instructed to keep itself quiet on that box you'll
see the version.

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Design Team, Melbourne IT
Fetch the comfy chair!




Make a file call it what ever you want (example: phpinfo.php) and write:

<? PHP_INFO() ?>

then run that script

Thank you,

--------------------------------------------
Brandon Orther
WebIntellects Design/Development Manager
[EMAIL PROTECTED]
800-994-6364
www.webintellects.com
-------------------------------------------- 


-----Original Message-----
From: Jeff Oien [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 12, 2001 4:31 PM
To: PHP
Subject: [PHP] How To Tell Which v. PHP?


Is there a script I can run to tell which version of PHP the
server is using to run it?

Details:
Two reasons I ask. One is if I have a client on an unfamiliar
server with bad or no documentation. Or to test when using 
.htaccess to use the .phtml extension for php3 when the server
would normally see that as a PHP2 file. 

Thanks.
Jeff Oien 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





phpversion()

Cheers,
Maxim Maletsky

and, there's a very nice tip here: www.php.net/phpversion

Cheers,
Maxim Maletsky



-----Original Message-----
From: Jeff Oien [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 9:31 AM
To: PHP
Subject: [PHP] How To Tell Which v. PHP?


Is there a script I can run to tell which version of PHP the
server is using to run it?

Details:
Two reasons I ask. One is if I have a client on an unfamiliar
server with bad or no documentation. Or to test when using 
.htaccess to use the .phtml extension for php3 when the server
would normally see that as a PHP2 file. 

Thanks.
Jeff Oien 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




use phpinfo();

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India

----- Original Message ----- 
From: "Jeff Oien" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 6:00 AM
Subject: [PHP] How To Tell Which v. PHP?


> Is there a script I can run to tell which version of PHP the
> server is using to run it?
> 
> Details:
> Two reasons I ask. One is if I have a client on an unfamiliar
> server with bad or no documentation. Or to test when using 
> .htaccess to use the .phtml extension for php3 when the server
> would normally see that as a PHP2 file. 
> 
> Thanks.
> Jeff Oien 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Does anyone have examples of using PHP to process forms?  I'd also like
to know if I can embed the code in my html file or do I have to write a
CGI server side script to do it?

Thanks,
Don

--
 <html>
<body>
<form action="your_phpscript.php" method="post">
What's your name
<input name="some_name" type="text">
<input type="submit">
</form>
</body>
</html>

When the submit button is pressed, the value of the some_name input field is
sent to your script.  Your script can access it as a variable named
$some_name. Example...

<?php
  echo ($some_name);
?>






> Does anyone have examples of using PHP to process forms?  I'd also like
> to know if I can embed the code in my html file or do I have to write a
> CGI server side script to do it?
> 
> Thanks,
> Don

Here's a form processor :

    foreach ($HTTP_POST_VARS as $key => $value) {

        print "$key : $value <br>\n";
    }

    See: http://www.php.net/manual/en/language.variables.predefined.php

    See: http://www.php.net/manual/en/language.variables.external.php

The above assumes you aren't using array (<input name="foo[]">) and that
you're using POST method (<form method="post">) if using GET change POST
to GET.  So simple yet so useful!  Can it be expanded?  Yes.

Yes, PHP and HTML "embed" nicely together, for example, like this :

    <h3><?php print $title ?></h3>
    <p>Hi, how are you <?php print $name ?> !!!  I am fine.</p>

    See: http://www.php.net/manual/en/language.basic-syntax.php

That assumes the file parses PHP, usually .php does this but depends on
setup.  Check/ask web host or try : .php3 , .php , .phtml ... and when you
do, have your first php script be :

    <?php

         print '<h3>Hello World (of PHP)</h3>';

         phpinfo();

    ?>

phpinfo is very nice, provides a lot of useful information about your
setup.  And yes, the server must be setup to parse PHP and the sysadmin
must do this, an end user cannot.  Information on that can be seen here :

    http://www.php.net/manual/en/installation.php

Also, consider checking out basic PHP tutorials found at devshed.com and
phpbuilder.com as well as the manual at php.net/manual/

Regards,

Philip Olson
http://www.cornado.com/

On Mon, 12 Feb 2001, Sean Kennedy wrote:

> Does anyone have examples of using PHP to process forms?  I'd also like
> to know if I can embed the code in my html file or do I have to write a
> CGI server side script to do it?
> 
> Thanks,
> Don
> 
> --
>  <html>
> <body>
> <form action="your_phpscript.php" method="post">
> What's your name
> <input name="some_name" type="text">
> <input type="submit">
> </form>
> </body>
> </html>
> 
> When the submit button is pressed, the value of the some_name input field is
> sent to your script.  Your script can access it as a variable named
> $some_name. Example...
> 
> <?php
>   echo ($some_name);
> ?>
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





http://www.thickbook.com/extra/index.phtml
Jeff Oien

> Does anyone have examples of using PHP to process forms?  I'd also like
> to know if I can embed the code in my html file or do I have to write a
> CGI server side script to do it?
> 
> Thanks,
> Don
> 




How can I associate a list of checkboxes to a list of texfields?

if I had only several checkboxes I'd have:
<input type=checkbox name=checklist[]>Cb1
<input type=checkbox name=checklist[]>Cb2 ... etc...

but what if have:
<input type=checkbox name=checklist[]>Cb1 <input type=text ...
<input type=checkbox name=checklist[]>Cb2 <input type=text ...

how would I associate each textfield to its checkbox? In the same array? in 
a different one? How??
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer





"Christian Dechery" <[EMAIL PROTECTED]> wrote:
> How can I associate a list of checkboxes to a list of texfields?
> but what if have:
> <input type=checkbox name=checklist[]>Cb1 <input type=text ...
> <input type=checkbox name=checklist[]>Cb2 <input type=text ...
>
> how would I associate each textfield to its checkbox? In the same array?
in
> a different one? How??

I would recommend generating these checkbox / text input field combos within
a loop and assign to separate arrays with the same key so you can match them
up when processing later.  Like this:

$num_inputs = 5; // if you want 5 sets of checkboxes and text inputs.

for ( $i = 0; $i < $num_inputs; $i++ )
    {
    echo "<input type=checkbox name=checklist[$i]>Cb $i <input type=text
name=text[$i]>\n";
    }

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/





can someone explain me how to use LOCK TABLES to subtitute transactions?

I don't seem to get how this is possible... and I really need this... I 
have a script that updates 4 tables at a time, and I have to be sure all of 
them are updated, or NONE... I can only see this possible using 
commit/rollback...

thanks...
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer





My company is willing to pay for some assistance in helping us install:

PHP apache mod with oracle 8i functions on a Solaris 8 box.

Are there any takers?

-- 
Richard Bradley
CTO YourLink, inc.
(321) 452-6699
IM lagoonr




I have written a regular expression that searches for any occurance of
src="*" in a html page and rewrites it so that it is equal to
src="http://www.whereever.com/images/filename.jpg" -

If there are five occurances of this match then it replaces them all. Is
there anyway to make it only run once. Then if I want to loop and do it
again. I want to do this so I can put the contents of the original * in
src="*" into and array and access them later for uploading the files.

Thanks

Scott Mebberson
[EMAIL PROTECTED]






I really need help with this.

 I have written a regular expression that searches for any occurance of
 src="*" in a html page and rewrites it so that it is equal to
 src="http://www.whereever.com/images/filename.jpg" -

 If there are five occurances of this match then it replaces them all. Is
 there anyway to make it only run once. Then if I want to loop and do it
 again. I want to do this so I can put the contents of the original * in
 src="*" into and array and access them later for uploading the files.

I think that maybe preg_match() or preg_match_all() is the answer but I have
know idea on how to make the regular expression I am using perl comptaible.

Here it is:
$txt = ereg_replace("src=\"([^>]+)\.(gif|jpg)\"",
"src=\"http://www.ezigraphics.com/images/about_0001." . //2. "\"", $txt);

Any ideas is a huge help - thankyou

 Thanks

 Scott Mebberson
[EMAIL PROTECTED]







Hi Guys,

Im looking for a way to parse a value from between two tags

<something>This is what i want to return</something>

Basically its simply a block of HTML from within a large HTML file.
Speed is definately a consideration in any solution.

Any ideas?

Cheers,

Mark
-- 
<< If I was a signature file, where would I be?? >>




This should do the trick.

<?
$file = fopen("filename.html", "r"); //it can also be a URL
$readfile = fread($file, 20000);
$read = eregi("<something>(.*)</something>", $readfile, $output);
fclose($file);
echo $output[1];
?>

cheers,

Thor.

-----Original Message-----
From: Mark Green [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 12, 2001 6:06 PM
To: PHP General Mailing List
Subject: [PHP] Parse HTML Block


Hi Guys,

Im looking for a way to parse a value from between two tags

<something>This is what i want to return</something>

Basically its simply a block of HTML from within a large HTML file.
Speed is definately a consideration in any solution.

Any ideas?

Cheers,

Mark
-- 
<< If I was a signature file, where would I be?? >>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






Right, this is also true ....

Cheers,
Maxim Maletsky

-----Original Message-----
From: Ben Peter [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 10, 2001 2:10 AM
To: Maxim Maletsky
Cc: 'Todd Cary'; [EMAIL PROTECTED]
Subject: Re: [PHP] echo vs print


Maxim Maletsky wrote:

> Anyway, "<?php" , "<?" are quite same too, except that php3 used to have
> "<?php" while older versions use mainly "<?", this is just about
> compatibility.

I believe <?php is needed if you want your scripts to be valid XML.

Ben

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




If you look closer, in PHP.INI you can find an alternative of your server.
In fact you can specify a completely different server to use in order to
send emails.

Cheers,
Maxim Maletsky

-----Original Message-----
From: Emmanuel Halphen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 4:08 AM
To: [EMAIL PROTECTED]
Subject: [PHP] How to send email


Hi,


I have a big problem.

I am trying to send email by php on a server which doesn't have sendmail
installed. In fact, we don't like to install it.

I use the 4.0.4pl1 version of PHP, and I have understand that the function
imap_mail doesn't work any more in this version.

Is there another option for me to send email ?

Thanks a lot for your help.

Emmanuel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




try using the SMTP class from the Kazzam Intranet Email system which I have
attached with the email.

Also, you can download the complete intranet web email application from
http://myprojects.cjb.net/ and take a look at the code for sending mail that
uses this class instead of sending the email

hope that helps

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India

----- Original Message -----
From: "Emmanuel Halphen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 12:37 AM
Subject: [PHP] How to send email


> Hi,
>
>
> I have a big problem.
>
> I am trying to send email by php on a server which doesn't have sendmail
> installed. In fact, we don't like to install it.
>
> I use the 4.0.4pl1 version of PHP, and I have understand that the function
> imap_mail doesn't work any more in this version.
>
> Is there another option for me to send email ?
>
> Thanks a lot for your help.
>
> Emmanuel
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]




subject says it all - any way to create a new folder in the filesystem?

regards,
andrew





See :

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

Regards,

Philip

On Mon, 12 Feb 2001, andrew wrote:

> subject says it all - any way to create a new folder in the filesystem?
> 
> regards,
> andrew
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





check out the file system function at

http://www.php.net/manual/en/ref.filesystem.php

you might also find some good classes to do the same at
phpclasses.upperdesign.com. check it up
regards
Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India

----- Original Message -----
From: "andrew" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 8:26 AM
Subject: [PHP] create filesystem folder?


> subject says it all - any way to create a new folder in the filesystem?
>
> regards,
> andrew
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Hiya

Could some one please give me a step in the right direction,

I've created a simple login script that checks the data base against the
user name and password that the user has inputted in aform, i want to have
stored in the session their user name and password, as well as their email.
I can get everything to work nicely except getting and saving the email from
the database.

My code is below,

Thanks in advance

Peter

<?
session_start();
if ($REQUEST_METHOD=='POST')
{
header('Expires: ' . gmdate("D, d M Y H:i:s", time()+1000) . ' GMT');
header('Cache-Control: Private');
}
session_register('user');
session_register('pass');
session_register('email');
$session = session_id();
$userid = '$user';

?>

<html>
<head>
 <title>Title</title>
</head>

<body>
<?
$open = mysql_connect("localhost", "root", "password")
    or die ("Unable to connect to server.");
mysql_select_db("db")
    or die ("Unable to select database.");
$sql = "SELECT *
    FROM users
    WHERE user='$user' and pass='$pass'";
$result = mysql_query($sql)
    or die ("Unable to get results.");
$num = mysql_numrows($result)
    or die ("You're not authorized to be here.  If you feel you have
recieved this
message in error, please contact the <a
href=\"mailto:\">webmaster</a>");

if ($num == 1) {
include "quote2.php";
}

?>



</body>
</html>





I have a need to use php similar to how I would bash when creating shell
scripts.  I have two RH6.2 machines that have the same version of php
(slightly different compile-options).  One machine in particular lacks the php
binary in /usr/local/bin and that's what I need to use php in a shell script.

I did ./configure --help to see if there was an option that I was missing and
nothing jumped out at me as being the obvious fix.  How do I compile PHP to
get this binary?

TIA,

-TB

***************************************
Tony Bibbs
Iowa Outdoors - Hunting and Fishing
http://www.iowaoutdoors.org
[EMAIL PROTECTED]
515.554.8046
***************************************







Hi Tony
Did you happen to check the manual? :)

This will get you started:
./configure --with-your-required-options --enable-discard-path



----- Original Message -----
From: "Tony Bibbs" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 1:18 PM
Subject: [PHP] Using php as a shell scripting language


> I have a need to use php similar to how I would bash when creating shell
> scripts.  I have two RH6.2 machines that have the same version of php
> (slightly different compile-options).  One machine in particular lacks the
php
> binary in /usr/local/bin and that's what I need to use php in a shell
script.
>
> I did ./configure --help to see if there was an option that I was missing
and
> nothing jumped out at me as being the obvious fix.  How do I compile PHP
to
> get this binary?
>
> TIA,
>
> -TB
>
> ***************************************
> Tony Bibbs
> Iowa Outdoors - Hunting and Fishing
> http://www.iowaoutdoors.org
> [EMAIL PROTECTED]
> 515.554.8046
> ***************************************
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>





On Tue, 13 Feb 2001 13:48, Tony Bibbs wrote:
> I have a need to use php similar to how I would bash when creating
> shell scripts.  I have two RH6.2 machines that have the same version of
> php (slightly different compile-options).  One machine in particular
> lacks the php binary in /usr/local/bin and that's what I need to use
> php in a shell script.
>
> I did ./configure --help to see if there was an option that I was
> missing and nothing jumped out at me as being the obvious fix.  How do
> I compile PHP to get this binary?

Leave out the Apache options, anything related to modules, etc. Here's 
what I use to build it as a CGI to run with a non-Apache server (I think 
this might be PHP3 but you'll get the idea)

./configure --with-gd=/usr/local --with-mysql=/usr/local/mysql 
--with-dbase=yes --enable-sysvshm=yes --enable-sysvsem=yes 
--with-config-file-path --enable-debug=no --enable-track-vars=yes 
--enable-bcmath=yes --bindir=/web/webdocs/cgi-bin

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




Hi,

Is there anything wrong with this code below?
Any help or fix to this code would be very much appreciated.



The file to get the data out (gif file):
--------------------------------
<?php

/* data_out.php3 */

$db = mysql_connect("www.server.com", "root", "password");
mysql_select_db("db_name", $db);
$sql = "select * from table_name order by 'date'";
$sql = "select * from table_name";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
print("<tr><td bgcolor=\"#003399\">");
printf("<img src=\"$indice_url\">%s</td></tr>\n",
$row["indice_url"]);
}
?>




Here's the "tiny" table that feeds it:
--------------------------------
CREATE TABLE indice (
    id int(11) DEFAULT '0' NOT NULL auto_increment,
    date text,
    indice text,
    indice_url varchar(255),
    PRIMARY KEY (id)
);
--------------------------------



Merci,

Yves
--


------------------------
Malouin Design Graphique
http://www.malouin.qc.ca

Québec (Québec)  CANADA





"Malouin Design Graphique" <[EMAIL PROTECTED]> wrote:
> Is there anything wrong with this code below?
> Any help or fix to this code would be very much appreciated.

Let's take a look.

> $db = mysql_connect("www.server.com", "root", "password");
> mysql_select_db("db_name", $db);
> $sql = "select * from table_name order by 'date'";
> $sql = "select * from table_name";

The second $sql overwrites the first so hopefully you didn't want the first.

> $result = mysql_query($sql);
> while ($row = mysql_fetch_array($result)) {
> print("<tr><td bgcolor=\"#003399\">");
> printf("<img src=\"$indice_url\">%s</td></tr>\n",
> $row["indice_url"]);

Where is $indice_url being set?  You call it in printf() but it was not
previously set in your code.  I think you just don't understand how to
properly use printf() and since you're not really using it to format a
string, like it's intended to be used I'm not going to bother to explain how
to use it.  I have an idea what you're trying to do, but in my opinion
printf(%s, $var) is a horrible way to pull data from a query result so
instead of showing you how to fix it, I'll show you a better way.  Why not
do something like:

$result = mysql_query( $sql );
while ( $row = mysql_fetch_array( $result ) )
    {
    echo "<tr><td><img src=\"$row[indice_url]\">$row[indice]</td></tr>\n";
    }

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/





On Tue, 13 Feb 2001 13:55, Malouin Design Graphique wrote:
> Hi,
>
> Is there anything wrong with this code below?
> Any help or fix to this code would be very much appreciated.
>
>
>
> The file to get the data out (gif file):
> --------------------------------
> <?php
>
> /* data_out.php3 */
>
> $db = mysql_connect("www.server.com", "root", "password");
> mysql_select_db("db_name", $db);
> $sql = "select * from table_name order by 'date'";
> $sql = "select * from table_name";
> $result = mysql_query($sql);
> while ($row = mysql_fetch_array($result)) {
> print("<tr><td bgcolor=\"#003399\">");
> printf("<img src=\"$indice_url\">%s</td></tr>\n",
> $row["indice_url"]);
> }
> ?>
>
Assuming that indice_url is a URL to an image file on the filesystem, 
that looks like it should work (although I don't understand printf <g>; 
can't see why that couldn't be just echo). So what shows up in your 
source?

>
>
>
> Here's the "tiny" table that feeds it:
> --------------------------------
> CREATE TABLE indice (
>     id int(11) DEFAULT '0' NOT NULL auto_increment,
>     date text,
>     indice text,
>     indice_url varchar(255),
>     PRIMARY KEY (id)
> );
> --------------------------------

Date as a _text_ field? You'll never have a Year 20000000000000 bug 
problem :-0

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




Yes SIR!  Steve!

THIS IS WORKING NOW!
MANY... MANY... MANY... THANKS FOR YOUR CODE!
As a newbie... I have been working so hard on this one...
You noticed that I have a lot of reading to do...

Best regards,

Merci encore, (Thanks again,)

Yves



At 22:41 -0500 12/02/2001, Steve Werby wrote:
>"Malouin Design Graphique" <[EMAIL PROTECTED]> wrote:
>>  Is there anything wrong with this code below?
>>  Any help or fix to this code would be very much appreciated.
>
>Let's take a look.
>
>>  $db = mysql_connect("www.server.com", "root", "password");
>>  mysql_select_db("db_name", $db);
>>  $sql = "select * from table_name order by 'date'";
>>  $sql = "select * from table_name";
>
>The second $sql overwrites the first so hopefully you didn't want the first.
>
>>  $result = mysql_query($sql);
>>  while ($row = mysql_fetch_array($result)) {
>>  print("<tr><td bgcolor=\"#003399\">");
>>  printf("<img src=\"$indice_url\">%s</td></tr>\n",
>>  $row["indice_url"]);
>
>Where is $indice_url being set?  You call it in printf() but it was not
>previously set in your code.  I think you just don't understand how to
>properly use printf() and since you're not really using it to format a
>string, like it's intended to be used I'm not going to bother to explain how
>to use it.  I have an idea what you're trying to do, but in my opinion
>printf(%s, $var) is a horrible way to pull data from a query result so
>instead of showing you how to fix it, I'll show you a better way.  Why not
>do something like:
>
>$result = mysql_query( $sql );
>while ( $row = mysql_fetch_array( $result ) )
>     {
>     echo "<tr><td><img src=\"$row[indice_url]\">$row[indice]</td></tr>\n";
>     }
>
>--
>Steve Werby
>COO
>24-7 Computer Services, LLC
>Tel: 804.817.2470
>http://www.247computing.com/

--


------------------------
Malouin Design Graphique
http://www.malouin.qc.ca

Québec (Québec)  CANADA





"Malouin Design Graphique" <[EMAIL PROTECTED]> wrote:
> THIS IS WORKING NOW!
> MANY... MANY... MANY... THANKS FOR YOUR CODE!

Glad to help!

> As a newbie... I have been working so hard on this one...
> You noticed that I have a lot of reading to do...

Everyone has to start somewhere.  printf() isn't the best way to pull data
from a MySQL result set, but you can blame that on the tutorial or code that
you were probably modeling your code after.  If you're new to PHP and even
to programming I recommend "Professional PHP Programming" by WROX
Publishing.  And there are good tutorials at places like zend.com and
sometimes at phpbuilder.com (though sometimes their tutorials could be
better).

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/





hey all,

Was just wondering how to do the following:

<?php
class Foo {

var $bar = $foo; // causes parse error
var $bar = "$foo"; // causes parse error
var $bar = '$foo'; // works but $foo is not evaluated

}
?>

So how does one correctly assign a variable to a variable inside a class withot doing 
something like:

var $bar = '';
$this->bar = $foo;

Any insight would be much appreciated.

Regards

Joseph




> Was just wondering how to do the following:
>
> <?php
> class Foo {
>
> var $bar = $foo; // causes parse error
> var $bar = "$foo"; // causes parse error
> var $bar = '$foo'; // works but $foo is not evaluated
>
> }
> ?>
>
> So how does one correctly assign a variable to a variable inside a class
withot doing something like:
>
> var $bar = '';
> $this->bar = $foo;
>
> Any insight would be much appreciated.

I was curious too, so I looked it up. Seems you can't. From
http://www.php.net/manual/en/language.oop.php

    "Note: In PHP 4, only constant initializers for var variables are
allowed. Use constructors for non-constant initializers."

Hope this helps,

Joe







On Mon, 12 Feb 2001 20:11:14 -0800
Joe wrote:

JC> 
JC> I was curious too, so I looked it up. Seems you can't. From
JC> http://www.php.net/manual/en/language.oop.php
JC> 
JC>     "Note: In PHP 4, only constant initializers for var variables are
JC> allowed. Use constructors for non-constant initializers."
JC> 
JC> Hope this helps,
JC> 
JC> Joe
JC> 

I missed that one little cryptic note :-) 

I basically just made a function that sets the var variable to what I wanted. Unless 
*anyone* knows a better way?

class Foo {
var $bar;

    function setBar($bar) {
      this->bar = $bar;
    }

}

Thanks for your help!

Regards,


Joseph






> So how does one correctly assign a variable to a variable inside a class withot 
>doing something like:
> 
> var $bar = '';
> $this->bar = $foo;
> 

That's how you have to do it.


class MyClass {
        var $bar;

        // This is the class's constructor
        sub MyClass () {
                $this->bar = $foo;
        }
}


Regards,

Sean





On Mon, 12 Feb 2001 23:44:08 -0500 (EST)
Sean wrote:

SC> 
SC> That's how you have to do it.
SC> 
SC> 
SC> class MyClass {
SC>     var $bar;
SC> 
SC>     // This is the class's constructor
SC>     sub MyClass () {
SC>             $this->bar = $foo;
SC>     }
SC> }

I didn't think php had sub routines like perl? shouldn't that be:

function MyClass(){
  $this->bar = $foo;
}

I tried this and it does not evaluate the variable. The only way I could get this to 
work was to create a function that I can pass the variable to as one of it paramaters 
(see previous post)

I could be wrong?


Regards


Joseph




> SC>
> SC> That's how you have to do it.
> SC>
> SC>
> SC> class MyClass {
> SC> var $bar;
> SC>
> SC> // This is the class's constructor
> SC> sub MyClass () {
> SC> $this->bar = $foo;
> SC> }
> SC> }
>
> I didn't think php had sub routines like perl? shouldn't that be:
>
> function MyClass(){
>   $this->bar = $foo;
> }
>
> I tried this and it does not evaluate the variable. The only way I could
get this to work was to create a function that I can pass the variable to as
one of it paramaters (see previous post)
>
> I could be wrong?
>


Is this closer to what you were looking for?
- Joe

<?PHP

 class Foo {

 var $bar;

 function mymethod(){

  global $foo;
  $this->bar = $foo;

 }

}

$foo = "hello world";

echo "<html><body>";

$cls = new foo();
$cls->mymethod();
echo $cls->bar;

echo "</body></html>";
?>





On Mon, 12 Feb 2001 21:04:30 -0800
Joe wrote:

JC> Is this closer to what you were looking for?
JC> - Joe
JC> 
JC> <?PHP
JC> 
JC>  class Foo {
JC> 
JC>  var $bar;
JC> 
JC>  function mymethod(){
JC> 
JC>   global $foo;
JC>   $this->bar = $foo;
JC> 
JC>  }
JC> 
JC> }
JC> 
JC> $foo = "hello world";
JC> 
JC> echo "<html><body>";
JC> 
JC> $cls = new foo();
JC> $cls->mymethod();
JC> echo $cls->bar;
JC> 
JC> echo "</body></html>";
JC> ?>
JC> 

hmm sort of is, basically this works:

// Foo.class.php
class Foo {

var $bar;

    setBar($bar) {
        $this->bar = $bar;
    }

}

// foo.php
include("Foo.class.php");
$foo = new Foo;
$bar = "1234567789";
$foo->setBar($bar);

Regards,

Joseph




you do this in the class constructor

class foo
{

  var $bar;

  function foo($fooval)
 {
    $this->bar=$fooval;
 }

}

hope that helps

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India

----- Original Message -----
From: "Joseph H Blythe" <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
Sent: Wednesday, February 14, 2001 9:27 AM
Subject: [PHP] help with classes


> hey all,
>
> Was just wondering how to do the following:
>
> <?php
> class Foo {
>
> var $bar = $foo; // causes parse error
> var $bar = "$foo"; // causes parse error
> var $bar = '$foo'; // works but $foo is not evaluated
>
> }
> ?>
>
> So how does one correctly assign a variable to a variable inside a class
withot doing something like:
>
> var $bar = '';
> $this->bar = $foo;
>
> Any insight would be much appreciated.
>
> Regards
>
> Joseph
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Have I lost something somewhere?

I have code which runs under PHP3.0.15, and PHP4.0.2 which references the
result of a

        $row = mysql_fetch_array($result_of_query);

by doing things like:

        $row["this_is_a_field_name"]

Seems simple, right?

Well - I compiled a new copy of Apache 1.3.17, pushed PHP up to 4.0.4pl1,
and upgraded mysql to the new stable version at the same time...

Now the above code doesnt work.  But if I do a:

        $row[this_is_a_field_name]

Then the code does work.

Have I messed up something in the PHP configuration that doesnt allow these
quoted identifiers anymore?

Or is this just a new (less-than-compatible) upgrade to PHP that I've missed
reading about??

Heeeeeeeeeeeeeeeeeelp me ... I dont want to have to rebuild all my sites
just because of these stupid quotes....








I'd be curious to see others' answers on this because I upgraded everything
the other day (been at php4 for a while though) and I don't have a problem
with the quotes.

On 2/12/01 11:11 PM this was written:

> Have I lost something somewhere?
> 
> I have code which runs under PHP3.0.15, and PHP4.0.2 which references the
> result of a
> 
> $row = mysql_fetch_array($result_of_query);
> 
> by doing things like:
> 
> $row["this_is_a_field_name"]
> 
> Seems simple, right?
> 
> Well - I compiled a new copy of Apache 1.3.17, pushed PHP up to 4.0.4pl1,
> and upgraded mysql to the new stable version at the same time...
> 
> Now the above code doesnt work.  But if I do a:
> 
> $row[this_is_a_field_name]
> 
> Then the code does work.
> 
> Have I messed up something in the PHP configuration that doesnt allow these
> quoted identifiers anymore?
> 
> Or is this just a new (less-than-compatible) upgrade to PHP that I've missed
> reading about??
> 
> Heeeeeeeeeeeeeeeeeelp me ... I dont want to have to rebuild all my sites
> just because of these stupid quotes....
> 

-- 

Thomas Deliduka
IT Manager
     -------------------------
New Eve Media
The Solution To Your Internet Angst
http://www.neweve.com/






"Scott Brown" <[EMAIL PROTECTED]> wrote:
> I have code which runs under PHP3.0.15, and PHP4.0.2 which references the
> result of a
> $row["this_is_a_field_name"]
>
> Well - I compiled a new copy of Apache 1.3.17, pushed PHP up to 4.0.4pl1,
> and upgraded mysql to the new stable version at the same time...
>
> Now the above code doesnt work.  But if I do a:

What error messages do you get?  Add this to beginning of your code and you
might get more error output that will help diagnose.

<?php error_reporting(E_ALL); ?>

> $row[this_is_a_field_name]
>
> Then the code does work.

Odd.  I've noticed the non-quoted versions causing PHP to choke if
error_reporting() is set high enough.  I've never know the opposite to be
true.

> Have I messed up something in the PHP configuration that doesnt allow
these
> quoted identifiers anymore?
>
> Or is this just a new (less-than-compatible) upgrade to PHP that I've
missed
> reading about??

It could be a configuration option or a php.ini setting.  Create a page with
<?php phpinfo(); ?> in it and post your configuration options to the list.

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/





"Scott Brown" <[EMAIL PROTECTED]> wrote:
> $row["this_is_a_field_name"]
>
> Seems simple, right?
>
> Well - I compiled a new copy of Apache 1.3.17, pushed PHP up to 4.0.4pl1,
> and upgraded mysql to the new stable version at the same time...
>
> Now the above code doesnt work.  But if I do a:

Forgot to ask - does referencing an array with double quotes around the key
work for arrays not associated with a MySQL result?  I doubt it's specific
to MySQL result arrays, but it doesn't hurt to check.  Make a small array
and test.

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/







> Forgot to ask - does referencing an array with double quotes
> around the key work for arrays not associated with a MySQL
> result?  I doubt it's specific to MySQL result arrays, but
> it doesn't hurt to check.  Make a small array and test.

I grabbed an example of of php.net dealing with just arrays and it works ...

Here's what I'm seeing - THIS WORKS:

<HTML>
<HEAD>
<TITLE>mysqltest</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<?
        require($DOCUMENT_ROOT . "/subs/sub.php");

        openDSN();

        echo "<table>\n";
        $rslt = mysql_query("select * from pricing");
        while ( $row = mysql_fetch_array($rslt) )
        {
                echo "<TR>\n";
                echo "<TD>$row[ID]</tD>";
                echo "<TD>$row[ProdCode]</tD>";
                echo "<TD>$row[Price_effdate]</tD>";
                echo "<TD>$row[ProdSetup]</tD>";
                echo "<TD>$row[ProdMonthly]</tD>";
                echo "<TD>$row[5]</tD>";
                echo "</TR>\n";
        }
        echo "</table>\n";
?>
</BODY>
</HTML>


But put any one of these $row[...] with quotes around their fieldnames and I
get:

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in /home/testnexus/public_html/test.php on line 16

(when line 16 =
                echo "<TD>$row["ID"]</tD>";
)







>
> I'd be curious to see others' answers on this because I
> upgraded everything
> the other day (been at php4 for a while though) and I don't
> have a problem
> with the quotes.
>

I've probably just putzed something somewhere during the build....  it's
been one of those days.

But the thing is it's consistant... if I quote my field names (single or
double) I get an error... if I dont, I get my result.

(see my response to Steve...)





"Scott Brown" <[EMAIL PROTECTED]> wrote:
> I grabbed an example of of php.net dealing with just arrays and it works
...
>
> Here's what I'm seeing - THIS WORKS:

<snip>
>         while ( $row = mysql_fetch_array($rslt) )
>         {
>                 echo "<TR>\n";
>                 echo "<TD>$row[ID]</tD>";
</snip>

> But put any one of these $row[...] with quotes around their fieldnames and
I
> get:
>
> Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
> `T_NUM_STRING' in /home/testnexus/public_html/test.php on line 16
>
> (when line 16 =
>                 echo "<TD>$row["ID"]</tD>";

The double quotes enclose the contents of the echo statement, but PHP chokes
because you have double quotes inside the echo statement.  If the exact line
above worked under PHP3.x I'm surprised.  Solutions include:

escaping the double quotes
echo "<TD>$row[\"ID\"]</TD>";

using no quotes or single quotes:
echo "<TD>$row['ID']</TD>";
echo "<TD>$row[ID]</TD>";

breaking apart the echo statement:
echo "<TD>" . $row["ID"] . "</TD>";

I don't think there's any way around this.  If you got it to work
differently in PHP3 I'd like to know how.  If for some reason you have a ton
of code you have to change now, you can write a PHP script which uses
regular expressions to find the double quotes to replace, write out the new
files and cycle through all your files.  It really wouldn't be that hard,
but I still suspect that the double quotes would have been a problem in PHP3
too.

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/





Great program man!

Carlos


"Christian Calloway" <[EMAIL PROTECTED]> wrote in message news:...
> Hey everyone,
>
> I just released phpdoc v2.0, which is a program used to document  PHP
class
> definitions.
> This version is a complete rewrite of v1.0, and takes a different approach
> to creating
> documentation.
>
> Where most other applications try to imitate Javadoc as much as possible,
> this application actually does very little, because it actually uses
Javadoc
> to create PHP documentation. Since the Javadoc API is quite open, and
since
> my application is in Java, its a simple matter to plugin to the Javadoc
> program. All my application does is parse a PHP class definition through
the
> use of regular expressions, and then convert that class definition from
PHP
> syntax to Java Syntax, then hand the converted source over to Javadoc.
What
> this means is that all the options and power of Javadoc is available to my
> program, you can use any Javadoc option, doclet, @tag or whatever in
phpdoc
> and in your source and the resulting documentation will be no different
then
> if an actual .java file were passed to Javadoc. All is explained in
greater
> detail
> at my site, and in instructions I provide.
>
> A final note, the library of Javadoc doclets are also open to you when
using
> phpdoc. For anyone
> whom doesnt know, doclets are programs written in the Java programming
> language that specify the
> content and format of the output of the Javadoc tool. By default, Javadoc
> uses the Standard doclet
> which creates the .HTML formatted documentation were all used to. You can
> provide any doclet
> you wish however to customize the output however you like. The wealth of
> third party doclets
> available at the javasoft site allow you to create for example RTF, PDF,
and
> even Japanese based
> API documentation.
>
> You must have the JDK installed on your system (of which Javadoc comes
part
> of)
>
> You can download phpdoc v2.0 at
> http://www.callowayprints.com/phpdoc/phpdoc.php
>
> Thanks Everyone,
>
> Christian
>
>
>






Sorry, I got this from a user. Didnt mean to send to newsgroup

> Great program man!
>
> Carlos
>
>
> "Christian Calloway" <[EMAIL PROTECTED]> wrote in message news:...
> > Hey everyone,
> >
> > I just released phpdoc v2.0, which is a program used to document  PHP
> class
> > definitions.
> > This version is a complete rewrite of v1.0, and takes a different
approach
> > to creating
> > documentation.
> >
> > Where most other applications try to imitate Javadoc as much as
possible,
> > this application actually does very little, because it actually uses
> Javadoc
> > to create PHP documentation. Since the Javadoc API is quite open, and
> since
> > my application is in Java, its a simple matter to plugin to the Javadoc
> > program. All my application does is parse a PHP class definition through
> the
> > use of regular expressions, and then convert that class definition from
> PHP
> > syntax to Java Syntax, then hand the converted source over to Javadoc.
> What
> > this means is that all the options and power of Javadoc is available to
my
> > program, you can use any Javadoc option, doclet, @tag or whatever in
> phpdoc
> > and in your source and the resulting documentation will be no different
> then
> > if an actual .java file were passed to Javadoc. All is explained in
> greater
> > detail
> > at my site, and in instructions I provide.
> >
> > A final note, the library of Javadoc doclets are also open to you when
> using
> > phpdoc. For anyone
> > whom doesnt know, doclets are programs written in the Java programming
> > language that specify the
> > content and format of the output of the Javadoc tool. By default,
Javadoc
> > uses the Standard doclet
> > which creates the .HTML formatted documentation were all used to. You
can
> > provide any doclet
> > you wish however to customize the output however you like. The wealth of
> > third party doclets
> > available at the javasoft site allow you to create for example RTF, PDF,
> and
> > even Japanese based
> > API documentation.
> >
> > You must have the JDK installed on your system (of which Javadoc comes
> part
> > of)
> >
> > You can download phpdoc v2.0 at
> > http://www.callowayprints.com/phpdoc/phpdoc.php
> >
> > Thanks Everyone,
> >
> > Christian
> >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Hi - I want to print a list of numbers linked to URLs I create on the fly -
something like this:
 
table:
-------------------
path        pid
---------|---------

foo.jpg     1
bar.jpg     1

<?php
 
include("db_connection_params.inc");  //all relevant database variables
$sql="select path from table where pid =1";  //obvious
$link_id = mysql_connect($host, $usr, $pass); //get connection handle

$result = mysql_db_query($database, $sql, $link_id);
$count = mysql_num_rows($result) or die ("no rows returned from $sql");

$i = 0; //initialze counter

for (0 < $i > $count; $currrent_row = mysql_fetch_row($result); ++$i;)

{ 
  
  $path=$current_row[2]"; //database field position matched index number
  print "<a href = $path>$count</a><br>"; //
}  

?>

so I want this to print:
1  (linked to foo.jpg)
2  (linked to bar.jpg)

The problem is I'm getting a parse error on the "for" line.

Any ideas?

TIA,
andrew





On Tue, 13 Feb 2001 15:24, andrew wrote:
> Hi - I want to print a list of numbers linked to URLs I create on the
> fly - something like this:
>
> table:
> -------------------
> path        pid
> ---------|---------
>
> foo.jpg     1
> bar.jpg     1
>
> <?php
>
> include("db_connection_params.inc");  //all relevant database variables
> $sql="select path from table where pid =1";  //obvious
> $link_id = mysql_connect($host, $usr, $pass); //get connection handle
>
> $result = mysql_db_query($database, $sql, $link_id);
> $count = mysql_num_rows($result) or die ("no rows returned from $sql");
>
> $i = 0; //initialze counter
>
> for (0 < $i > $count; $currrent_row = mysql_fetch_row($result); ++$i;)

I think you want something more like
for($i = 0; $i < $count; $i++)
{
$current_row = mysql_fetch_row($result);
>
> {
>
>   $path=$current_row[2]"; //database field position matched index
> number print "<a href = $path>$count</a><br>"; //
Instead of this, you could do
extract($current_row);
echo "<a href = $path>$count</a><br>";
> }
>
> ?>
>
> so I want this to print:
> 1  (linked to foo.jpg)
> 2  (linked to bar.jpg)
>
> The problem is I'm getting a parse error on the "for" line.
>
> Any ideas?
>
> TIA,
> andrew

Or a slightly more elegant solution:
 include("db_connection_params.inc");  //all relevant database variables
 $sql="select path from table where pid =1";  //obvious
 $link_id = mysql_connect($host, $usr, $pass); //get connection handle
 $result = mysql_db_query($database, $sql, $link_id); 
/* put a die on the above or better use mysql_error */
 $i = 1; //initialise counter
 while($row=mysql_fetch_array($result)){
   extract($row);
   echo "<a href=\"$path\">$i</a><br>";
   $i++;
  }

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




David, Theo,

Got it working - much thanks for your help!!

regards,
andrew


On 2/13/01 12:05 AM, "David Robley" <[EMAIL PROTECTED]>
wrote:

> On Tue, 13 Feb 2001 15:24, andrew wrote:
>> Hi - I want to print a list of numbers linked to URLs I create on the
>> fly - something like this:
>> 
>> table:
>> -------------------
>> path        pid
>> ---------|---------
>> 
>> foo.jpg     1
>> bar.jpg     1
>> 
>> <?php
>> 
>> include("db_connection_params.inc");  //all relevant database variables
>> $sql="select path from table where pid =1";  //obvious
>> $link_id = mysql_connect($host, $usr, $pass); //get connection handle
>> 
>> $result = mysql_db_query($database, $sql, $link_id);
>> $count = mysql_num_rows($result) or die ("no rows returned from $sql");
>> 
>> $i = 0; //initialze counter
>> 
>> for (0 < $i > $count; $currrent_row = mysql_fetch_row($result); ++$i;)
> 
> I think you want something more like
> for($i = 0; $i < $count; $i++)
> {
> $current_row = mysql_fetch_row($result);
>> 
>> {
>> 
>>   $path=$current_row[2]"; //database field position matched index
>> number print "<a href = $path>$count</a><br>"; //
> Instead of this, you could do
> extract($current_row);
> echo "<a href = $path>$count</a><br>";
>> }
>> 
>> ?>
>> 
>> so I want this to print:
>> 1  (linked to foo.jpg)
>> 2  (linked to bar.jpg)
>> 
>> The problem is I'm getting a parse error on the "for" line.
>> 
>> Any ideas?
>> 
>> TIA,
>> andrew
> 
> Or a slightly more elegant solution:
> include("db_connection_params.inc");  //all relevant database variables
> $sql="select path from table where pid =1";  //obvious
> $link_id = mysql_connect($host, $usr, $pass); //get connection handle
> $result = mysql_db_query($database, $sql, $link_id);
> /* put a die on the above or better use mysql_error */
> $i = 1; //initialise counter
> while($row=mysql_fetch_array($result)){
>  extract($row);
>  echo "<a href=\"$path\">$i</a><br>";
>  $i++;
> }





you have an extra semicolon in the for statement

it should be

 for (0 < $i > $count; $currrent_row = mysql_fetch_row($result); ++$i)




   $path=$current_row[2]"; file://database field position matched index
number
   print "<a href = $path>$count</a><br>"; //
 }


hope that helps

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India

----- Original Message -----
From: "andrew" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 10:24 AM
Subject: [PHP] Build HREF list from database???


> Hi - I want to print a list of numbers linked to URLs I create on the
fly -
> something like this:
>
> table:
> -------------------
> path        pid
> ---------|---------
>
> foo.jpg     1
> bar.jpg     1
>
> <?php
>
> include("db_connection_params.inc");  file://all relevant database
variables
> $sql="select path from table where pid =1";  file://obvious
> $link_id = mysql_connect($host, $usr, $pass); file://get connection handle
>
> $result = mysql_db_query($database, $sql, $link_id);
> $count = mysql_num_rows($result) or die ("no rows returned from $sql");
>
> $i = 0; file://initialze counter
>
> for (0 < $i > $count; $currrent_row = mysql_fetch_row($result); ++$i;)
>
>

>
>   $path=$current_row[2]"; file://database field position matched index
number
>   print "<a href = $path>$count</a><br>"; //
> }
>
> ?>
>
> so I want this to print:
> 1  (linked to foo.jpg)
> 2  (linked to bar.jpg)
>
> The problem is I'm getting a parse error on the "for" line.
>
> Any ideas?
>
> TIA,
> andrew
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Hi,
    I'm wondering what're the best classes available for reading/
sending emails?

I want to do a webmail solution (for myself at first), and don't want 
to use IMP. I'd need to be able to handle attachments as well.

Any pointers?

Cheers,

Gfunk         -          http://www.gfunk007.com/

I sense much beer in you. Beer leads to intoxication, intoxication to
hangovers, and hangovers to... suffering.
  






try using the class that I adopted for my intranet email solution from the
avialable classes on the net aqnd added some functions especially suited for
a webmail application.

I also developed a webmail solution called Kazam Intranet Email Solution
usign this class. you can download the complete program including the class
from http://myprojects.cjb.net/ or hotscripts.com (just search for Kazzam)

The code should help you in understanding the use of the class.

hope that helps

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India



----- Original Message -----
From: "Josh G" <[EMAIL PROTECTED]>
To: "PHP User Group" <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 10:17 AM
Subject: [PHP] Mail classes


> Hi,
>     I'm wondering what're the best classes available for reading/
> sending emails?
>
> I want to do a webmail solution (for myself at first), and don't want
> to use IMP. I'd need to be able to handle attachments as well.
>
> Any pointers?
>
> Cheers,
>
> Gfunk         -          http://www.gfunk007.com/
>
> I sense much beer in you. Beer leads to intoxication, intoxication to
> hangovers, and hangovers to... suffering.
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Hi!
How to get this to work for every month:

$tomorrow = date ("d", mktime(0,0,0,0,date("d") +4 ) );                  
echo "Today + 4 days  is $tomorrow <br>";
screws up Feb et al....


Thanks,

Christopher C. M. Allen





I'm having problem with Netscape6 does not resend valid POST data to PHP. Netscape is waiting until connection timeout. If I hit stop button, it logs warning message attached to this mail. (These forms work fine with IE5.x, NN4.5) To find out what's wrong, I made a very simple form. With this simple form, Netscape6 can use back button as it supposed to. There should be something wrong in my form class code. (I don't send any header at all - both class and test form. Basically, this class and form gets user data from HTTP_POST_VARS, checks it, and displays it) Form class is based on PHPLIB7.2c's oohforms - heavily customized to do more strict form vars checking and to improve performance, etc. I think the same problem occurred with original ooform.inc. (I don't remember well) Does anyone have similar problem? and the solution? Any hints? If you would like to see the code, please mail me. (it's about 33KB) Thanks in advance. ==== ERROR LOG WHEN USER HIT NETSCAPE6'S STOP BUTTON==== [13- 2-2001 09:57:21] PHP Warning: No content-type in POST request in Unknown on line 0 [13- 2-2001 09:57:21] PHP Warning: Cannot send session cookie - headers already sent by (output started at /home/httpd/html/tmp/test/form_class_test.php:178) in /home/httpd/html/include/lib/session.inc on line 139 [13- 2-2001 09:57:21] PHP Warning: Cannot send session cache limiter - headers already sent (output started at /home/httpd/html/tmp/test/form_class_test.php:178) in /home/httpd/html/include/lib/session.inc on line 139 ===== Yasuo Ohgaki -- [EMAIL PROTECTED]



Hi,

Can you have a SELECT statement (using mysql) that goes something like

$sql="SELECT id && email FROM table WHERE user='$user' and pass='$pass'";

and if you can't is there a away around this?

Thanks

Peter




Assuming you want to select both id and email from table, use commas :

    SELECT id,email FROM ...

Also, check out this basic SQL tutorial :

    http://www.sqlcourse.com/

It's fairly useful.

regards,

Philip

On Tue, 13 Feb 2001, Peter Houchin wrote:

> Hi,
> 
> Can you have a SELECT statement (using mysql) that goes something like
> 
> $sql="SELECT id && email FROM table WHERE user='$user' and pass='$pass'";
> 
> and if you can't is there a away around this?
> 
> Thanks
> 
> Peter
> 





On Tue, 13 Feb 2001 16:00, Peter Houchin wrote:

> > Hi,
>
> Can you have a SELECT statement (using mysql) that goes something like
>
> $sql="SELECT id && email FROM table WHERE user='$user' and
> pass='$pass'";
>
> and if you can't is there a away around this?
>
> Thanks
>
> Peter

In SQL queries, you normally separate the required fields with a comma, so

$sql="SELECT id, email FROM table WHERE user='$user' and pass='$pass'";

would work, assuming id and email are fields in the table 'table'.

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA








ok I've changed my code to 

$sql = "SELECT id, email FROM users WHERE user='$user' and pass='$pass'";
but still no joy can any one suggest why?  

(& Yes email is a field in the table)

Peter

> Hi,
> 
> Can you have a SELECT statement (using mysql) that goes something like
> 
> $sql="SELECT id && email FROM table WHERE user='$user' and pass='$pass'";





A possible way to find out :

    $result = mysql_query($sql) or die(mysql_error());

Does it say anything?  mysql_error() is your friend, it can be printed
anywhere within the script and will print the last mysql error.  So
perhaps :

    print mysql_error();

Right before the query or ...

Regards,

Philip

On Tue, 13 Feb 2001, Peter Houchin wrote:

> 
> 
> 
> 
> ok I've changed my code to 
> 
> $sql = "SELECT id, email FROM users WHERE user='$user' and pass='$pass'";
> but still no joy can any one suggest why?  
> 
> (& Yes email is a field in the table)
> 
> Peter
> 
> > Hi,
> > 
> > Can you have a SELECT statement (using mysql) that goes something like
> > 
> > $sql="SELECT id && email FROM table WHERE user='$user' and pass='$pass'";
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





On Tue, 13 Feb 2001 16:20, Peter Houchin wrote:
> ok I've changed my code to
>
> $sql = "SELECT id, email FROM users WHERE user='$user' and
> pass='$pass'"; but still no joy can any one suggest why?
>
> (& Yes email is a field in the table)
>
> Peter
>
> > Hi,
> >
> > Can you have a SELECT statement (using mysql) that goes something
> > like
> >
> > $sql="SELECT id && email FROM table WHERE user='$user' and
> > pass='$pass'";

What is (not) happening? Any errors? Try using mysql_error() after you 
pass the query to the DB and see if there is a useful message.

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




you can set the maximum execution timeu using either the

max_execution_time = 30     ; Maximum execution time of each script, in
seconds

setting in php.ini

or can set it at runtime for a script using  the set_time_limit() function

check the php manual for more details.

hope that helps

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India





----- Original Message -----
From: "Martin E. Koss" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, February 12, 2001 5:20 PM
Subject: [PHP] Run a script for 20minutes


> Hi,
> I have PHP3 and MySQL on Win98 and am trying to run a script that loops
> through a file making process and it needs about 20 - 30 minutes to run.
It
> generates static HTML files based on content in a database. I've increased
> Internet Explorer's timeout to allow for this but for some reason only
about
> half the processing is done before everything seems to just stop.
>
> Does anyone know of a very basic way of executing a PHP script on a Win98
> machine without the need for a browser? Or, another way of running this
> script that will take some time and create some 22,000 files through the
> process.
>
> Thanks,
>
> Martin.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Okay, im a little stumped. I have been asked to use a formula which 
calculates Monthly Repayments on a mortgage loan. The formula I have been 
given is

M = P * ( J / (1 - (1 + J) ** -N))

My problem is, the last part. It explains it in english as "then take that 
to the -N (minus N) power"

My problem is, I have no idea how to put this into a PHP script so that it 
can calculate it out. I have a feeling im falling short at the "to the 
power of" part. I tried to do a 3 to the power of 3 calculation and I cant 
get it to spit out 27 like I know it should.

Any suggestions ?


Thanks


Chris





> Okay, im a little stumped. I have been asked to use a formula which
> calculates Monthly Repayments on a mortgage loan. The formula I have been
> given is
>
> M = P * ( J / (1 - (1 + J) ** -N))
>
> My problem is, the last part. It explains it in english as "then take that
> to the -N (minus N) power"
>
> My problem is, I have no idea how to put this into a PHP script so that it
> can calculate it out. I have a feeling im falling short at the "to the
> power of" part. I tried to do a 3 to the power of 3 calculation and I cant
> get it to spit out 27 like I know it should.
>

Chris,

I think this is what you're looking for:

<?PHP
echo "<html><body>";

// principle
$P = 180000;

// annual rate divided by 12 months
$J = 0.0775/12;

// 30 years times 12 months
$N = 360;

// monthly payment
$M = $P*($J/(1-pow((1+$J),-$N)));

echo $M;

echo "</body></html>";
?>

Hope this helps,

Joe






On Tue, 13 Feb 2001 16:09, Chris Aitken wrote:
> Okay, im a little stumped. I have been asked to use a formula which
> calculates Monthly Repayments on a mortgage loan. The formula I have
> been given is
>
> M = P * ( J / (1 - (1 + J) ** -N))
>
> My problem is, the last part. It explains it in english as "then take
> that to the -N (minus N) power"
>
> My problem is, I have no idea how to put this into a PHP script so that
> it can calculate it out. I have a feeling im falling short at the "to
> the power of" part. I tried to do a 3 to the power of 3 calculation and
> I cant get it to spit out 27 like I know it should.
>
> Any suggestions ?
>
>
> Thanks
>
>
> Chris

Check out exp() and pow()

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




use stripslashes on the data being posted.

for ex if the text field name is varText

use $varText=stripslashes($varText)

That should take care of it

regards

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India

----- Original Message ----- 
From: "John P. Donaldson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 12, 2001 10:11 PM
Subject: [PHP] character problem


> I've created a PHP script that is called from a form
> to send an email.  The contents of the email is a
> hidden value in the form named "info," and is
> typically a paragraph of text.  It works fine,
> however, for some reason, the apostrophy character
> always gets emailed looking like this: /'
> 
> I've tried everything to get around this.  Any ideas? 
> Here's my script and form:
> 
> Form:
> 
> <form name="form1" method="GET"
> action="emailsender.php">
> <p>Email this product info to a friend</p>
> <input type="text" name="email">
> <input type="submit" name="Submit" value="Email Info">
> <input type="hidden" name="info" value="This is the
> text that gets emailed.  I'm having problems with the
> apostrophe character in this text though">
> </form>
> 
> 
> Script file named emailsender.php:
> 
> <?php
> print "<p>The product info has been mailed to:
> <b>$email</b>";
> 
> $to = $email;
> $sender ="[EMAIL PROTECTED]";
> 
> MAIL( 
> "$email", # address to send $info email to
> "Product Info", # subject
> "$info", # hidden form field containing text to email
> "From: $sender\nX-Mailer: PHP/" . phpversion()); 
> 
> ?> 
> 
> 
> Thanks in advance,
> John
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35 
> a year!  http://personal.mail.yahoo.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Hi!

I am facing some problems while uploading files..
I just copied the code from php.net from the section
"Handling File Uploads".

My index.php pages has the following code:

<html>
        <head>
                <title>File Uploads</title>
                
        </head>
<body>
<FORM ENCTYPE="multipart/form-data"
ACTION="action.php" METHOD=POST>
<INPUT TYPE="hidden" name="MAX_FILE_SIZE"
value="2000">
Send this file: <INPUT NAME="userfile" TYPE="file">
<INPUT TYPE="submit" VALUE="Send File">
</FORM>


</body>
</html>




ACtion.php has the following code:

<?php 
if (is_uploaded_file($userfile)) {
    copy($userfile, "(c:\\)");
} else {
    echo "Possible file upload attack: filename
'$userfile'.";
}
/* ...or... */
move_uploaded_file($userfile, "(c:\\)");
?>


I always get the error: message..

[Possible file upload attack: filename 'none'.]


Can anybody tell me what could be the possible reason
for this.


Thanx a lot!
Dhaval Desai

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/


Reply via email to