[PHP] MySQL

2002-02-05 Thread jtjohnston

In MySQL, I have a date field that is formatted 000-00-00 Is there a
function in PHP I did not find yet that does this?
John


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




[PHP] Re: MySQL

2002-02-05 Thread jtjohnston

$date = date (Y-m-d); #works?
:)

Jtjohnston wrote:

 In MySQL, I have a date field that is formatted 000-00-00 Is there a
 function in PHP I did not find yet that does this?
 John


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




[PHP] PHP script for command line

2002-02-05 Thread Alex Shi

I am now trying to use php script from command line. Everything is 
Ok except only one thing: it will always send out header msg. How 
can stop it from sending header?

Alex Shi


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




[PHP] date( ) - function

2002-02-05 Thread soma

i have one question

linux system's time is right but php's date () function time is wrong...

different system time and php's date( ) time

is date () function call to the system time ?

thansk

/soma



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




[PHP] 72dpi with gdlibrary2?

2002-02-05 Thread Andy

Hi there,

I would like to create images with 72 dpi with gdlibrary2.01

Is this possible?

Thanx Andy




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




RE: [PHP] Limit 15 where Newest

2002-02-05 Thread Tim Ward


If (!$start) $start=0;
$sql=select author, title, chapter from table order by date DESC
limit $start, 15;
...

and a link on the same page:
echo(a href='samepage?start= . ($start + 15) . 'next/a);

or something like that

Tim
www.chessish.com http://www.chessish.com 


--
From:  Tyler Longren [SMTP:[EMAIL PROTECTED]]
Sent:  05 February 2002 04:49
To:  WIll; [EMAIL PROTECTED]
Subject:  Re: [PHP] Limit 15 where  Newest

$sql=select author, title, chapter from table order by date DESC
limit 15;

That's how you'd go about getting the 15 most recent table entries.
The
next 15 thing will require a bit more though.

Tyler

- Original Message -
From: WIll [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 04, 2002 9:37 PM
Subject: [PHP] Limit 15 where Newest


 I am trying to write a limit statement for my database. I want to
say
 something like

 $sql=select author, title, chapter from database where
last_update =
 Newest order by date limit 15;

 My question is how do you say  Newest in php MySQL?
 And how do you put t link on the bottom of the page that will
select the
 next 15 items in the database?

 Thank you.

 --WIll

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




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




Re: [PHP] PHP script for command line

2002-02-05 Thread Lars Torben Wilson

On Tue, 2002-02-05 at 00:36, Alex Shi wrote:
 I am now trying to use php script from command line. Everything is 
 Ok except only one thing: it will always send out header msg. How 
 can stop it from sending header?
 
 Alex Shi

There are full instructions in the manual. Essentially, you
are looking for the -q command line option.

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


Hope this helps,

Torben

-- 
 Torben Wilson [EMAIL PROTECTED]
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


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




Re: [PHP] date( ) - function

2002-02-05 Thread Mike Maltese

try date(H:i:s,time()).

Mike
- Original Message - 
From: soma [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 05, 2002 12:32 AM
Subject: [PHP] date( ) - function


 i have one question
 
 linux system's time is right but php's date () function time is wrong...
 
 different system time and php's date( ) time
 
 is date () function call to the system time ?
 
 thansk
 
 /soma
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 



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




[PHP] cURL

2002-02-05 Thread Sandeep Murphy

Hi,

Can anyone point me out to some good resources on cURL??

Have to send 3 fields, Action,Username and Password for authentification 
 to a Servlet  and receive its response..

TIA,

sands

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




[PHP] Compare values in an array

2002-02-05 Thread Rainer

Can anybody tell me how I easily compare values in an associative array?

I have for instance an array like:

$foo['key1'] = 'abc';
$foo['key2'] = 'def';
$foo['key3'] = 'abc';
$foo['key4'] = 'ghi';

and I want to get the value 'abc' ...

Please send me an email ([EMAIL PROTECTED]) because my newsgroups
doesn't always work properly!

Thanx,
Rainer.



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




[PHP] Re: HTTP Error 405 using POST method

2002-02-05 Thread Rainer

In your example I see that you forgot /head after your /title ... maybe
that's the problem!


Scott Adams [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi. I'm learning PHP3 on an IIS 4.0 box and I started by trying out this
 simple HTML form. The form lets the user input his/her name, email
address,
 and select whether he/she likes oranges or apples and sends the data to a
 .php file that displays what the user input on the HTML form. The form
 method is POST. When I submit the data I type, I receive an HTTP Error 405
 message with the following text:
 start of error message
 HTTP Error 405
 405 Method Not Allowed

 The method specified in the Request Line is not allowed for the resource
 identified by the request. Please ensure that you have the proper MIME
type
 set up for the resource you are requesting.

 Please contact the server's administrator if this problem persists.
 end of error message

 Here is the HTML page with the form I am using:

 HTML
 HEAD
 TITLERequest for more information/TITLE
 BODY
 CENTERWould you like more information about our company?
 P
 FORM ACTION=email.php3 METHOD=POST
 Your name:BR
 INPUT TYPE=text NAME=name SIZE=20 MAXLENGTH=30
 P
 Your email address:BR
 INPUT TYPE=text NAME=email SIZE=20 MAXLENGTH=30
 P
 I prefer:
 SELECT NAME=preference
 OPTION value = ApplesApples
 OPTION value = OrangesOranges
 /SELECT
 P
 INPUT TYPE=submit VALUE=Send it!
 /FORM
 /CENTER
 /BODY
 /HTML

 What am I doing wrong?





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




[PHP] Tricky array question

2002-02-05 Thread Andy

Hi there,

I have a tricky array question.

My app is passing via post a array variable called glacier. Now I am
checking for the content
of this array. Because there are more of those arrays, I am getting all the
names out of a db.

How is it possible to get the value and keep the name of the array dynamic?

e.g:
Array name passed by post is: $glacier //
contains e.g. $glacier[0] = testname
Array with category names coming out of db is:   $category // contains e.g.
$category[0] = glacier

 echo $categories[0]; // returns glacier
 echo $glacier[0];  // returns testname

I tryed $categories[0][0] but it returns only the first letter of glacier
(g)

Any ideas??

Thanx, Andy




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




Re: [PHP] Tricky array question

2002-02-05 Thread Edward van Bilderbeek - Bean IT

try using something like this:

$varname = $categories[0];

echo ${$varname}[0];



Greets,

Edward



Andy [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...

 Hi there,



 I have a tricky array question.



 My app is passing via post a array variable called glacier. Now I am

 checking for the content

 of this array. Because there are more of those arrays, I am getting all
the

 names out of a db.



 How is it possible to get the value and keep the name of the array
dynamic?



 e.g:

 Array name passed by post is: $glacier //

 contains e.g. $glacier[0] = testname

 Array with category names coming out of db is: $category // contains e.g.

 $category[0] = glacier



 echo $categories[0]; // returns glacier

 echo $glacier[0]; // returns testname



 I tryed $categories[0][0] but it returns only the first letter of glacier

 (g)



 Any ideas??



 Thanx, Andy









 --

 PHP General Mailing List (http://www.php.net/)

 To unsubscribe, visit: http://www.php.net/unsub.php




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




RE: [PHP] Tricky array question

2002-02-05 Thread Niklas Lampén

It should be $category[0] = $glacier;
^--- ERROR in you code


Niklas


-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]] 
Sent: 5. helmikuuta 2002 11:59
To: [EMAIL PROTECTED]
Subject: [PHP] Tricky array question


Hi there,

I have a tricky array question.

My app is passing via post a array variable called glacier. Now I am
checking for the content of this array. Because there are more of those
arrays, I am getting all the names out of a db.

How is it possible to get the value and keep the name of the array
dynamic?

e.g:
Array name passed by post is: $glacier
//
contains e.g. $glacier[0] = testname
Array with category names coming out of db is:   $category // contains
e.g.
$category[0] = glacier

 echo $categories[0]; // returns glacier
 echo $glacier[0];  // returns testname

I tryed $categories[0][0] but it returns only the first letter of
glacier
(g)

Any ideas??

Thanx, Andy




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


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




[PHP] Re: Tricky array question

2002-02-05 Thread Rainer

Hi Andy,

I was just reading your message, do I see that you send an array with a
form?
Like input name=glacier[x] ?
I just wanted you to know that using brackets [] is not allowed in the
html-name attribute! Your html-page will not validate :(

The sollution is sending al your vars as simple vars (no array) and collect
them with HTTP_GET_VARS[] or HTTP_POST_VARS[], php-variables.

Maybe this will also be a sollution for your problem... just take a look
from another point of view :)

Cheers,
Rainer.


Andy [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there,

 I have a tricky array question.

 My app is passing via post a array variable called glacier. Now I am
 checking for the content
 of this array. Because there are more of those arrays, I am getting all
the
 names out of a db.

 How is it possible to get the value and keep the name of the array
dynamic?

 e.g:
 Array name passed by post is: $glacier //
 contains e.g. $glacier[0] = testname
 Array with category names coming out of db is:   $category // contains
e.g.
 $category[0] = glacier

  echo $categories[0]; // returns glacier
  echo $glacier[0];  // returns testname

 I tryed $categories[0][0] but it returns only the first letter of glacier
 (g)

 Any ideas??

 Thanx, Andy






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




[PHP] Find the nearest dealer in Germany on a given ZIP (PLZ)

2002-02-05 Thread Markus Straessle

Hi List !

I have a question on a topic that's been dealt with here before (but only
for the US).

I am looking for a soultion to find - via php /database - a way to search
for the shortest
distance between a given ZIP Code and available dealers nearby. So, let's
assume I am living
in German ZIP Code 7. I want to look for my nearest dealer. php and the
database should
be able to tell me where it is. Does anybody know how to achieve this ? Like
in www.mediamarkt.de or
at www.hp.com ?

So it should be possible somehow. Do I have to link German ZIPs (=PLZs) to
geographical data ?
Where Can I get them from ? You cannot work on ZIPs alone, right ? how can
you calculate the distance ?

Thanks for any help

Markus


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




Re: [PHP] Re: Changes in Sessions (PHP Versions)

2002-02-05 Thread Yasuo Ohgaki

If you really need to use 4.0.6, try to use different
session save handler and/or serializer. Try WDDX
serializer at first, then try verious combinations.

If you use other save handler/serializer, it may work.
I suggest you to upgrade, though...

--
Yasuo Ohgaki


Travis Simpson wrote:
 Sorry, I probably worded my question wrong.
 
 I am creating a 10 step (or so) form that is non-linear... The user
 enters all of their information and is able to go back and change
 information that they have filled in. So I have the form (POST)
 information set into session variables as soon as they click Next in
 the form. Well, with 4.1.1 there were no problems... It ALL worked
 perfectly. But unfortunately, in 4.0.6 it doesn't act the same.
 
 I just have a foreach loop go through all the POST variables and make
 them into SESSION variables,
 
 --- Snippet ---
 start_session();
 foreach ($HTTP_POST_VARS as $key = $value) {
   $HTTP_SESSION_VARS[$key] = $value;
 }
 --- End Snippet ---
 
 Easy enough... Now, I have all the 10 steps linked to on the side bar.
 a href=step1.php?PHPSESSID=$PHPSESSIDStep 1/a
 
 But for some weird reason, those links BLANK all the session variables.
 I tested this by doing a count() on the HTTP_SESSION_VARS array. And as
 soon as I click one of the Step links on the side, it clears all of
 them. I am not sure if I am doing this wrong, but it works fine (as I
 said) in 4.1.1.
 
 Another problem that I seem to be having... Is that 4.0.6 almost seems
 like it is maxing out with a certain number of SESSION variables. Once
 it has so many, it just starts over.
 
 I will just post the link here tomorrow, unfortunately I don't have the
 files on this computer.
 
 I hope this is a little more clear.
 
 Thanks,
 -Travis
 
 
 
 -Original Message-
 From: Yasuo Ohgaki [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, February 04, 2002 6:11 PM
 To: [EMAIL PROTECTED]; Travis Simpson
 Subject: [PHP] Re: Changes in Sessions (PHP Versions)
 
 
 Travis Simpson wrote:
 
Hey,

I am just wondering if there were any changes done to the session 
engine or settings between PHP 4.0.6 and 4.1.1.

I have been getting nothing but grief from 4.0.6 and 4.1.1 seems to 
work fine.


 
 
 What did work with 4.0.6 and what didn't with 4.1.1?
 
 If you are trying to use mm/msession save handler, it's broken somewhat.
 
 


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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




[PHP] Re: Tricky array question

2002-02-05 Thread Andy

Hello Rainer,

what kind of disadvantages do I take with me, if my form does not validate?
Is this a problem because of the spiders,
or the functionality?

It works fine so far on all browsers I know.

Can you please give more details?

Thanx Andy


Rainer [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Andy,

 I was just reading your message, do I see that you send an array with a
 form?
 Like input name=glacier[x] ?
 I just wanted you to know that using brackets [] is not allowed in the
 html-name attribute! Your html-page will not validate :(

 The sollution is sending al your vars as simple vars (no array) and
collect
 them with HTTP_GET_VARS[] or HTTP_POST_VARS[], php-variables.

 Maybe this will also be a sollution for your problem... just take a look
 from another point of view :)

 Cheers,
 Rainer.


 Andy [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi there,
 
  I have a tricky array question.
 
  My app is passing via post a array variable called glacier. Now I am
  checking for the content
  of this array. Because there are more of those arrays, I am getting all
 the
  names out of a db.
 
  How is it possible to get the value and keep the name of the array
 dynamic?
 
  e.g:
  Array name passed by post is: $glacier
//
  contains e.g. $glacier[0] = testname
  Array with category names coming out of db is:   $category // contains
 e.g.
  $category[0] = glacier
 
   echo $categories[0]; // returns glacier
   echo $glacier[0];  // returns testname
 
  I tryed $categories[0][0] but it returns only the first letter of
glacier
  (g)
 
  Any ideas??
 
  Thanx, Andy
 
 
 





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




RE: [PHP] Re: Tricky array question

2002-02-05 Thread Niklas Lampén

I think you should ignore that. I use it all the times, and it works
fine.


Niklas


-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]] 
Sent: 5. helmikuuta 2002 12:37
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Tricky array question


Hello Rainer,

what kind of disadvantages do I take with me, if my form does not
validate? Is this a problem because of the spiders, or the
functionality?

It works fine so far on all browsers I know.

Can you please give more details?

Thanx Andy


Rainer [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Andy,

 I was just reading your message, do I see that you send an array with 
 a form? Like input name=glacier[x] ?
 I just wanted you to know that using brackets [] is not allowed in the
 html-name attribute! Your html-page will not validate :(

 The sollution is sending al your vars as simple vars (no array) and
collect
 them with HTTP_GET_VARS[] or HTTP_POST_VARS[], php-variables.

 Maybe this will also be a sollution for your problem... just take a 
 look from another point of view :)

 Cheers,
 Rainer.


 Andy [EMAIL PROTECTED] wrote in message 
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi there,
 
  I have a tricky array question.
 
  My app is passing via post a array variable called glacier. Now I am

  checking for the content of this array. Because there are more of 
  those arrays, I am getting all
 the
  names out of a db.
 
  How is it possible to get the value and keep the name of the array
 dynamic?
 
  e.g:
  Array name passed by post is:
$glacier
//
  contains e.g. $glacier[0] = testname
  Array with category names coming out of db is:   $category //
contains
 e.g.
  $category[0] = glacier
 
   echo $categories[0]; // returns glacier
   echo $glacier[0];  // returns testname
 
  I tryed $categories[0][0] but it returns only the first letter of
glacier
  (g)
 
  Any ideas??
 
  Thanx, Andy
 
 
 





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


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




Re: [PHP] Re: Tricky array question

2002-02-05 Thread val petruchek

Hello!

a have following mysql problem:
i need to execute several inserts at one query like this-

$sql-action(insert into words(word) values ('php');
insert into words(word) values ('general');
insert into words(word) values ('list'););

The word fild is unique

My problem is: when certain word (e.g. 'php') already exists in table words
all the query fails

I do not want to check every word on existance and then insert only new
words.

I want mysql to ignore fails. How can i do it?

Thanx

Valentin Petruchek (aki Zliy Pes)
http://zliypes.com.ua
mailto:[EMAIL PROTECTED]




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




Re: [PHP] Tricky array question

2002-02-05 Thread Andy

This was just an error in my explenation I ment categories.

Meanwhile I tryed var vars, but it does not work for any reason?!?!?

My code looks like:

 $field = $categories[0].[0];
 echo $field;// returns glacier[0]
 echo 'var '.$$field.'br'; // returns bluddy nothing
 echo $categories[0]; // returns  glacier
 echo $glacier[0];// returns 110

Does anybody know how to get the 110 out of the array?

Thanx for any help,

Andy



Niklas lampén [EMAIL PROTECTED] schrieb im Newsbeitrag
008101c1ae2d$a9df7580$ba93c5c3@Niklas">news:008101c1ae2d$a9df7580$ba93c5c3@Niklas...
 It should be $category[0] = $glacier;
 ^--- ERROR in you code


 Niklas


 -Original Message-
 From: Andy [mailto:[EMAIL PROTECTED]]
 Sent: 5. helmikuuta 2002 11:59
 To: [EMAIL PROTECTED]
 Subject: [PHP] Tricky array question


 Hi there,

 I have a tricky array question.

 My app is passing via post a array variable called glacier. Now I am
 checking for the content of this array. Because there are more of those
 arrays, I am getting all the names out of a db.

 How is it possible to get the value and keep the name of the array
 dynamic?

 e.g:
 Array name passed by post is: $glacier
 //
 contains e.g. $glacier[0] = testname
 Array with category names coming out of db is:   $category // contains
 e.g.
 $category[0] = glacier

  echo $categories[0]; // returns glacier
  echo $glacier[0];  // returns testname

 I tryed $categories[0][0] but it returns only the first letter of
 glacier
 (g)

 Any ideas??

 Thanx, Andy




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




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




Re: [PHP] Re: Tricky array question

2002-02-05 Thread Andy

Put an @ infront of your comand

Andy


Val Petruchek [EMAIL PROTECTED] schrieb im Newsbeitrag
000801c1ae32$6fc1e360$[EMAIL PROTECTED]">news:000801c1ae32$6fc1e360$[EMAIL PROTECTED]...
 Hello!

 a have following mysql problem:
 i need to execute several inserts at one query like this-

 $sql-action(insert into words(word) values ('php');
 insert into words(word) values ('general');
 insert into words(word) values ('list'););

 The word fild is unique

 My problem is: when certain word (e.g. 'php') already exists in table
words
 all the query fails

 I do not want to check every word on existance and then insert only new
 words.

 I want mysql to ignore fails. How can i do it?

 Thanx

 Valentin Petruchek (aki Zliy Pes)
 http://zliypes.com.ua
 mailto:[EMAIL PROTECTED]






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




[PHP] Seams not to be possible

2002-02-05 Thread Andy

This was just an error in my explenation I ment categories.

Meanwhile I tryed var vars, but it does not work for any reason?!?!?

My code looks like:

 $field = $categories[0].[0];
 echo $field;// returns glacier[0]
 echo 'var '.$$field.'br'; // returns bluddy nothing
 echo $categories[0]; // returns  glacier
 echo $glacier[0];// returns 110

Does anybody know how to get the 110 out of the array?

Thanx for any help,

Andy
Andy [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there,

 I have a tricky array question.

 My app is passing via post a array variable called glacier. Now I am
 checking for the content
 of this array. Because there are more of those arrays, I am getting all
the
 names out of a db.

 How is it possible to get the value and keep the name of the array
dynamic?

 e.g:
 Array name passed by post is: $glacier //
 contains e.g. $glacier[0] = testname
 Array with category names coming out of db is:   $category // contains
e.g.
 $category[0] = glacier

  echo $categories[0]; // returns glacier
  echo $glacier[0];  // returns testname

 I tryed $categories[0][0] but it returns only the first letter of glacier
 (g)

 Any ideas??

 Thanx, Andy






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




[PHP] mysql fails

2002-02-05 Thread val petruchek

Sorry, incorrect subj!
Hello!

a have following mysql problem:
i need to execute several inserts at one query like this-

$sql-action(insert into words(word) values ('php');
insert into words(word) values ('general');
insert into words(word) values ('list'););

The word fild is unique

My problem is: when certain word (e.g. 'php') already exists in table words
all the query fails

I do not want to check every word on existance and then insert only new
words.

I want mysql to ignore fails. How can i do it?

Thanx

Valentin Petruchek (aki Zliy Pes)
http://zliypes.com.ua
mailto:[EMAIL PROTECTED]






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




RE: [PHP] Tricky array question

2002-02-05 Thread Niklas Lampén

Ahem... So you want to have a two dimensional variable?

?
$Array = array(110, 220); // You array to add to $TwoDimensional
array
$TwoDimensional = array(); // Define $TwoDimensional to be an array
$TwoDimensional[0] = $Array; // Insert values from $Array to
$TwoDimensional
print Var: .$TwoDimensional[0][0].brbr; 
?


Is this what you are looking for?


Niklas

-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]] 
Sent: 5. helmikuuta 2002 12:54
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Tricky array question


This was just an error in my explenation I ment categories.

Meanwhile I tryed var vars, but it does not work for any reason?!?!?

My code looks like:

 $field = $categories[0].[0];
 echo $field;// returns glacier[0]
 echo 'var '.$$field.'br'; // returns bluddy nothing
 echo $categories[0]; // returns  glacier
 echo $glacier[0];// returns 110

Does anybody know how to get the 110 out of the array?

Thanx for any help,

Andy



Niklas lampén [EMAIL PROTECTED] schrieb im Newsbeitrag
008101c1ae2d$a9df7580$ba93c5c3@Niklas">news:008101c1ae2d$a9df7580$ba93c5c3@Niklas...
 It should be $category[0] = $glacier;
 ^--- ERROR in you code


 Niklas


 -Original Message-
 From: Andy [mailto:[EMAIL PROTECTED]]
 Sent: 5. helmikuuta 2002 11:59
 To: [EMAIL PROTECTED]
 Subject: [PHP] Tricky array question


 Hi there,

 I have a tricky array question.

 My app is passing via post a array variable called glacier. Now I am 
 checking for the content of this array. Because there are more of 
 those arrays, I am getting all the names out of a db.

 How is it possible to get the value and keep the name of the array 
 dynamic?

 e.g:
 Array name passed by post is: $glacier
 //
 contains e.g. $glacier[0] = testname
 Array with category names coming out of db is:   $category // contains
 e.g.
 $category[0] = glacier

  echo $categories[0]; // returns glacier
  echo $glacier[0];  // returns testname

 I tryed $categories[0][0] but it returns only the first letter of 
 glacier
 (g)

 Any ideas??

 Thanx, Andy




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




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


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




[PHP] Re: Tricky array question

2002-02-05 Thread Rainer

Hi Andy,
What Niklas wrote is true, at this moment it works fine, but.

when I write code, I always ask myself which factors are constant and still
will work in, let's say, about 3 years from now.
The fact is that you cannot know which kind of useragents (read
browsertypes) there will be in future. What you DO know is that w3c is
setting up rules on which future useragents will rely on. If you follow
these rules you won't be surprised in future! Look at www.w3c.org - XHTML.

My suggestion:

in your html-doc -

form action=mycode.php method=post name=form1 
input name=form1_var1
input name=form1_var2
input name=form1_var3
etc..
/form

form action=mycode.php method=post name=form2 
 input name=form2_var1
input name=form2_var2
input name=form2_var3
etc..
/form

in mycode.php -

?php

while ($myvar = each($HTTP_POST_VARS)) {
$myarray[$myvar['key']] = $myvar['value'] ;
}

?

Rainer.

Andy [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello Rainer,

 what kind of disadvantages do I take with me, if my form does not
validate?
 Is this a problem because of the spiders,
 or the functionality?

 It works fine so far on all browsers I know.

 Can you please give more details?

 Thanx Andy


 Rainer [EMAIL PROTECTED] schrieb im Newsbeitrag
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi Andy,
 
  I was just reading your message, do I see that you send an array with a
  form?
  Like input name=glacier[x] ?
  I just wanted you to know that using brackets [] is not allowed in the
  html-name attribute! Your html-page will not validate :(
 
  The sollution is sending al your vars as simple vars (no array) and
 collect
  them with HTTP_GET_VARS[] or HTTP_POST_VARS[], php-variables.
 
  Maybe this will also be a sollution for your problem... just take a look
  from another point of view :)
 
  Cheers,
  Rainer.
 
 
  Andy [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hi there,
  
   I have a tricky array question.
  
   My app is passing via post a array variable called glacier. Now I am
   checking for the content
   of this array. Because there are more of those arrays, I am getting
all
  the
   names out of a db.
  
   How is it possible to get the value and keep the name of the array
  dynamic?
  
   e.g:
   Array name passed by post is: $glacier
 //
   contains e.g. $glacier[0] = testname
   Array with category names coming out of db is:   $category // contains
  e.g.
   $category[0] = glacier
  
echo $categories[0]; // returns glacier
echo $glacier[0];  // returns testname
  
   I tryed $categories[0][0] but it returns only the first letter of
 glacier
   (g)
  
   Any ideas??
  
   Thanx, Andy
  
  
  
 
 





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




[PHP] add value to serialized array?

2002-02-05 Thread Bas Jobsen

Hi,

At start test.txt contains a serialized array with value one and two.
a:2:{i:0;s:3:one;i:1;s:3:two;}
after one run this is:
a:3:{i:0;s:3:one;i:1;s:3:two;i:2;s:4:tree;}

But the last row prints nothing. Why?

Tnx,

Bas 

?
$array=array();
$fp=fopen(test.txt,r);
flock($fp,1);
$array=unserialize(fread($fp,filesize(test.txt)));
flock($fp,3);
fclose($fp);

array_push($array,tree);

$fp=fopen(test.txt,w+);
flock($fp,2);
fwrite($fp,serialize($array));
flock($fp,3);
fclose($fp);

$fp=fopen(test.txt,r);
flock($fp,1);
$array=unserialize(fread($fp,filesize(test.txt)));
flock($fp,3);
fclose($fp);

echo $array[0].$array[1].$array[2];
?

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




Re: [PHP] mysql fails

2002-02-05 Thread DL Neil

Hello val,

 a have following mysql problem:
 i need to execute several inserts at one query like this-
 
 $sql-action(insert into words(word) values ('php');
 insert into words(word) values ('general');
 insert into words(word) values ('list'););
 
 The word fild is unique
 
 My problem is: when certain word (e.g. 'php') already exists in table words
 all the query fails
 
 I do not want to check every word on existance and then insert only new
 words.
 
 I want mysql to ignore fails. How can i do it?


MySQL manual 6.4.3  INSERT Syntax
Check out INSERT [IGNORE]

Regards,
=dn



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




[PHP] Sending files to the user...?

2002-02-05 Thread Alan McFarlane

The problem:

How to I send a file to the user? Sounds simple but, assume I have a 'daily
report' option from my main web page. When the user clicks on it, they are
taken to the file 'generate_report.php' (sample included).

Now, this code should generate the report, compress it if required and send
it ot the user - i.e. a dialog box opens asking the user to open/save/run
the incoming file.

Question is, how? - I've toyed with Content-Disposition but I'm not sure of
any reference materials for this. (Perhaps someone knows the RFC)

The code:

?php
/* file: generate_report.php */

// build the report
$report = xml...; /* basically an xml document

// compress if possible
if (extension_loaded(zlib)  (strlen($report)  1024))
{
$report = gzcompress($report);
$compress = true;
}
else
{
$compressed = false;
}

$length = strlen($report);// I presume this can handle binary data

//header( something );

?



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




[PHP] Re: Sending files to the user...?

2002-02-05 Thread Alan McFarlane

Oh, and BTW, after sending the file, I will be redirecting the user to a
different page...

Alan McFarlane [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 The problem:

 How to I send a file to the user? Sounds simple but, assume I have a
'daily
 report' option from my main web page. When the user clicks on it, they are
 taken to the file 'generate_report.php' (sample included).

 Now, this code should generate the report, compress it if required and
send
 it ot the user - i.e. a dialog box opens asking the user to open/save/run
 the incoming file.

 Question is, how? - I've toyed with Content-Disposition but I'm not sure
of
 any reference materials for this. (Perhaps someone knows the RFC)

 The code:

 ?php
 /* file: generate_report.php */

 // build the report
 $report = xml...; /* basically an xml document

 // compress if possible
 if (extension_loaded(zlib)  (strlen($report)  1024))
 {
 $report = gzcompress($report);
 $compress = true;
 }
 else
 {
 $compressed = false;
 }

 $length = strlen($report);// I presume this can handle binary data

 //header( something );

 ?





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




RE: [PHP] Re: Sending files to the user...?

2002-02-05 Thread Jerry Verhoef (UGBI)

Your are on the right track.

Using the Header function is the way to do it.
But I guess you forget to take a look at the manual page. There are all
questions that you ask answered :) 

So take a look http://www.php.net/manual/en/function.header.php .

in short:
RFC: http://www.w3.org/Protocols/rfc2616/rfc2616
Force download:
header(Content-type: application/pdf);
header(Content-Disposition: attachment; filename=downloaded.pdf);

/* ... output pdf file ... */


Kind Regards,
Jerry
 -Original Message-
 From: Alan McFarlane [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 05, 2002 1:36 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Sending files to the user...?
 
 
 Oh, and BTW, after sending the file, I will be redirecting 
 the user to a
 different page...
 
 Alan McFarlane [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  The problem:
 
  How to I send a file to the user? Sounds simple but, assume I have a
 'daily
  report' option from my main web page. When the user clicks 
 on it, they are
  taken to the file 'generate_report.php' (sample included).
 
  Now, this code should generate the report, compress it if 
 required and
 send
  it ot the user - i.e. a dialog box opens asking the user to 
 open/save/run
  the incoming file.
 
  Question is, how? - I've toyed with Content-Disposition but 
 I'm not sure
 of
  any reference materials for this. (Perhaps someone knows the RFC)
 
  The code:
 
  ?php
  /* file: generate_report.php */
 
  // build the report
  $report = xml...; /* basically an xml document
 
  // compress if possible
  if (extension_loaded(zlib)  (strlen($report)  1024))
  {
  $report = gzcompress($report);
  $compress = true;
  }
  else
  {
  $compressed = false;
  }
 
  $length = strlen($report);// I presume this can handle 
 binary data
 
  //header( something );
 
  ?
 
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


The information contained in this email is confidential and
may be legally privileged. It is intended solely for the 
addressee. Access to this email by anyone else is 
unauthorized. If you are not the intended recipient, any 
form of disclosure, production, distribution or any action 
taken or refrained from in reliance on it, is prohibited and 
may be unlawful. Please notify the sender immediately.

The content of the email is not legally binding unless 
confirmed by letter bearing two authorized signatures.

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




[PHP] Name of file included

2002-02-05 Thread Ron Dyck

I need to access the name of a file included.

ie: in index.php I've included various files, among them navigation.inc.
Instead of manually typing !--navigation.inc-- at the top of everyfile,
I'd like to use something like: !--$included_file--

===
  Ron Dyck
  WebbTech
  www.WebbTech.net
  [EMAIL PROTECTED]




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




[PHP] How do I find double values in an associative array

2002-02-05 Thread Rainer

Hello group,

Can anybody tell me how I easily compare values in an associative array? I
would like to find double values

I have for instance an array like:

$foo['key1'] = 'abc';
$foo['key2'] = 'def';
$foo['key3'] = 'abc';
$foo['key4'] = 'ghi';

and I want to get the value 'abc' ...

Please send me an email ([EMAIL PROTECTED]) because my newsgroups
doesn't always work properly!

Thanx,
Rainer.



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




RE: [PHP] How do I find double values in an associative array

2002-02-05 Thread Jerry Verhoef (UGBI)

http://www.php.net/manual/en/function.array-count-values.php


Jerry

I feel like a manual... 

 -Original Message-
 From: Rainer [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 05, 2002 2:51 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] How do I find double values in an associative array
 
 
 Hello group,
 
 Can anybody tell me how I easily compare values in an 
 associative array? I
 would like to find double values
 
 I have for instance an array like:
 
 $foo['key1'] = 'abc';
 $foo['key2'] = 'def';
 $foo['key3'] = 'abc';
 $foo['key4'] = 'ghi';
 
 and I want to get the value 'abc' ...
 
 Please send me an email ([EMAIL PROTECTED]) because 
 my newsgroups
 doesn't always work properly!
 
 Thanx,
 Rainer.
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


The information contained in this email is confidential and
may be legally privileged. It is intended solely for the 
addressee. Access to this email by anyone else is 
unauthorized. If you are not the intended recipient, any 
form of disclosure, production, distribution or any action 
taken or refrained from in reliance on it, is prohibited and 
may be unlawful. Please notify the sender immediately.

The content of the email is not legally binding unless 
confirmed by letter bearing two authorized signatures.

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




Re: [PHP] How to get the URL into a var?

2002-02-05 Thread J.F.Kishor

hi,

I don't know whether this will solve your problem, but the
following prints the full path of the file that is being used.

script language=php

$uri = getenv('REQUEST_URI'); 

$path = $HTTP_SERVER_VARS[PATH_TRANSLATED];

// This prints /~user/subapp/test.php
   echo br$uribr; 

// This prints /home/servername/username/public_html/subapp/test.php
   echo brpath : $pathbr;
/script

regards
- JFK
kishor
Nilgiri Networks

On Sat, 2 Mar 2002, Andy wrote:

 Hi there,
 
 I am trying to find out which dir the user is browsing. How can I get the
 URL into a var? I tryed path_info, but it only returns the filename.
 
 Here is an example:
 
 URL: http://www.server.com/subapp/test.php
 
 Should return :
 
 subapp
 
 Is this possible??
 
 Thanx for any help
 
 Cheers Andy
 
 
 
 -- 
 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, visit: http://www.php.net/unsub.php




[PHP] Getting variables from a text file

2002-02-05 Thread David Orn Johannsson








I have this text file I have to retreve infromation from, in
the fallowing format:

date1=1/1/2002title1=some titleheadline1=some
headlinefull1=full articledate2=2/1/2002title2=some
title and so on



what would be the best thing for me to do to if I was to get
the values of all the variables of the text file into a php
document as variables.



Regards, David





Davíð
Örn Jóhannssson

Vefforritari



Atómstöðin
hf.

Garðastræti
37

101
Reykjavík



sími:
595-3643

fax:
595-3649

[EMAIL PROTECTED]

http://www.atom.is














[PHP] Unable to get ImageTTFText output

2002-02-05 Thread Neil Freeman

Hi there,

I am trying to use the ImageTTFText function to output some text onto an
existing image. Problem being though that the text does not get
outputted. I have placed the ttf file 'arial.ttf' within the same
directory as my script. Here is a snippet of my code:

Header(Content-Type: image/png);
$im = ImageCreateFromPNG(original_image.png);

$text_colour = ImageColorAllocate($im, 255, 255, 255);

ImageTTFText($im, 20, 0, 3, 3, $text_colour, /arial.ttf, My
text);

ImagePNG($im);

All this outputs is my original PNG image (with no text). I have used
the following line instead of ImageTTFText and all works well.

ImageString($im, 4, 3, 3, My text, $text_colour);

Using phpinfo() I have checked the GD section and the following is
outputted:

GD Support - enabled
GD Version - 2.0 or higher
FreeType Support - enabled
FreeType Linkage - with freetype
JPG Support - enabled
PNG Support - enabled
WBMP Support - enabled

Does anyone have any suggestions as to why this does not work? Has
anyone else used the ImageTTFText function successfully?

Neil

 Email:  [EMAIL PROTECTED]
 [EMAIL PROTECTED]




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




[PHP] Change of Language

2002-02-05 Thread Nicolas Llamosas

How can in change the language in my site? (spanish)
for example using the function date. (LANG?)

Thanks
Nicolás Llamosas


_
MSN Photos es la manera más sencilla de compartir, editar e imprimir sus 
fotos favoritas. http://photos.latam.msn.com/Support/WorldWide.aspx


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




Re: [PHP] Change of Language

2002-02-05 Thread Edward van Bilderbeek - Bean IT

check out: setlocale()

Greets,

Edward

- Original Message -
From: Nicolas Llamosas [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 05, 2002 4:13 PM
Subject: [PHP] Change of Language


 How can in change the language in my site? (spanish)
 for example using the function date. (LANG?)

 Thanks
 Nicolás Llamosas


 _
 MSN Photos es la manera más sencilla de compartir, editar e imprimir sus
 fotos favoritas. http://photos.latam.msn.com/Support/WorldWide.aspx


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




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




[PHP] Mysql

2002-02-05 Thread Roman Duriancik

Pleae help me !

I need delete record from table user.mysql in mysql database, i log on in
mysql like root and I log on on linux server like root. But when I write
command : delete from user where user=''; mysql send me error message :
ERROR 1036 Table 'user; is read only !
Thans for you helps...

roman




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




[PHP] PHP module build problem

2002-02-05 Thread Anas Mughal

I am trying to build PHP3 into apache 1.3.
I have vanilla PHP and Apache sources.
When I do the final Apache 'make', I get an error
message complaining about not able to find target for
alloc.h. The 'alloc.h' file is declared as a
dependency for 'mod_php3.o' in the Makefile in folder
'src/modules/php3'. 

Any advice would be greatly helpful.

=
Anas Mughal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Tel: 973-249-6665

__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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




Re: [PHP] Unable to get ImageTTFText output

2002-02-05 Thread Girish Nath

Hi

I had similar problems when just specifying the font file in the same
directory eg ./arial.ttf but got it to work okay when i used the full path
eg :

$fontfile = /apache/htdocs/arial.ttf;

ImageTTFText($im, 20, 0, 3, 3, $text_colour, $fontfile, My text);

Regards


Girish
--
www.girishnath.co.uk


- Original Message -
From: Neil Freeman [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Tuesday, February 05, 2002 2:59 PM
Subject: [PHP] Unable to get ImageTTFText output


Hi there,

I am trying to use the ImageTTFText function to output some text onto an
existing image. Problem being though that the text does not get
outputted. I have placed the ttf file 'arial.ttf' within the same
directory as my script. Here is a snippet of my code:

Header(Content-Type: image/png);
$im = ImageCreateFromPNG(original_image.png);

$text_colour = ImageColorAllocate($im, 255, 255, 255);

ImageTTFText($im, 20, 0, 3, 3, $text_colour, /arial.ttf, My
text);

ImagePNG($im);

All this outputs is my original PNG image (with no text). I have used
the following line instead of ImageTTFText and all works well.

ImageString($im, 4, 3, 3, My text, $text_colour);

Using phpinfo() I have checked the GD section and the following is
outputted:

GD Support - enabled
GD Version - 2.0 or higher
FreeType Support - enabled
FreeType Linkage - with freetype
JPG Support - enabled
PNG Support - enabled
WBMP Support - enabled

Does anyone have any suggestions as to why this does not work? Has
anyone else used the ImageTTFText function successfully?

Neil

 Email:  [EMAIL PROTECTED]
 [EMAIL PROTECTED]




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



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




RE: [PHP] testing for cookies on the server side (again, still can't get my head around it)

2002-02-05 Thread Johnson, Kirk

 So what's the flow of code to test for cookies on the server 
 side?  I'm
 pretty sure that the only way is to set a cookie, then test for it.

That is pretty much it. On the first page request to your application, if
PHP encounters a session_start() in your code, it will return a cookie named
PHPSESSID in the response headers. So you need to look for that cookie in
the request for the *second* page. If cookies are enabled in the browser,
the browser will return the cookie in the next request. Here's some code to
put at the top of the 2nd page:

?php
function check_cookies() {
global $HTTP_COOKIE_VARS;
if(!$HTTP_COOKIE_VARS[PHPSESSID]) {
header(Location: ./cookie_error.php);
exit();
}
}
?

I usually make my index.php page just set up the session, etc., then do an
automatic redirect to my second page, which is the first visible page. I put
the cookie check on this second page.

Kirk

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




Re: [PHP] Getting variables from a text file

2002-02-05 Thread Girish Nath

Hi

It looks like a querystring, so read the contents of the file into a variable, then 
use the parse_str() function on that variable, you can specify if you want them to be 
stored in an array too.

http://www.php.net/manual/en/function.parse-str.php

Regards


Girish
--
www.girishnath.co.uk

  - Original Message - 
  From: David Orn Johannsson 
  To: [EMAIL PROTECTED] 
  Sent: Tuesday, February 05, 2002 2:50 PM
  Subject: [PHP] Getting variables from a text file


  I have this text file I have to retreve infromation from, in the fallowing format:

  date1=1/1/2002title1=some titleheadline1=some headlinefull1=full 
articledate2=2/1/2002title2=some title and so on

   

  what would be the best thing for me to do to if I was to get the values of all the 
variables of the text file into a php document as variables.

   

  Regards, David

   

  

  Davíð Örn Jóhannssson

  Vefforritari

  

  Atómstöðin hf.

  Garðastræti 37

  101 Reykjavík

  

  sími: 595-3643

  fax: 595-3649

  [EMAIL PROTECTED]

  http://www.atom.is

  



   




[PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Edward R. Bailey

Hi,

I am working on a page the displays the output of a query in a table and
I only want to show the field labels that have corresponding output from
the database. I am only really concerned with the last label in the
table.

The label is called Notes and the corresponding field in the database
is memberNotes 

So I wrote the following script where I think I am saying if memberNotes
returns any value then print the output of $notes in the table cell
where it is called, but nothing happens and the output of $notes is not
displayed regardless whether memberNotes has any output.

?php If ($memberNotes =='1') {
  $notes = div align=\/left\/font
size=\/-1\/bNotes:/b/font/div;
 }else {
  $notes = div align=\/left\/font
size=\/-1\/b/b/font/div;
 }
?

In the table cell I placed the following

?php print $notes; ?

Can anyone see what I am doing wrong??

Thanks for the help

Ed


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




[PHP] PHP / MYSQL security bug

2002-02-05 Thread Gerard Onorato

Maybe I missed the thread but I was wondering if anyone has seen this 
report or done any testing on it.

We tested it and it seems a pretty valid problem. Can anyone comment on a 
fix that may be in the works?

Gerard

-
Security Advisory DW020203-PHP
Release: 3rd February 2002
PHP Safe Mode Filesystem Circumvention Problem
Severity: Medium to high.
Affects: PHP, all versions which include safe_mode feature.
Platform: UNIX, Microsoft Windows, any platforms on which PHP is available.
Vendor: http://php.net.
Discovered: 12th January 2002, Dave Wilson [EMAIL PROTECTED], using
PHP 4.1.0  Apache 2 on Linux.

--

VULNERABILITY IN BRIEF
PHP (since version 3?) includes a commonly used feature known as Safe Mode.
When enabled, scripts are highly limited in their ability to access or
execute local files, among other things.
PHP relies on a wrapper function around all filesystem calls to perform
access checks, but unforunately the bundled MySQL client library has not
been modified to perform such checks on LOAD DATA INFILE LOCAL
statements.
If an attacker has access to a MySQL server (either provided by you or
himself), he can use it as a proxy by which to download files residing on
the safe_mode-enabled web server. For large ISPs relying on this feature
for individual customer privacy, it could mean clients accessing each
other's files, or viewing of files on an improperly secured server.

FIX
Currently, no fix exists. You may use other PHP safe_mode functions to
disable the use of the MySQL client library, or secure your servers in a
proper fashion.. A suggested fix for the PHP developers might be to scan
mysql_query()s for strings similar to LOAD DATA LOCAL INFILE.
Happy hackers out there might like to look at libmysql.c:1764 if interested
in fixing this problem, although that may only be possible from within PHP.

EXAMPLE
The attached script will (once configured correctly) attempt to read
/var/log/lastlog via the SQL daemon and return it to the client.
$ cp safe_mode.php /www
$ wget -qO lastlog_via_mysql localhost/safe_mode.php
$ diff /var/log/lastlog lastlog_via_mysql; echo $?
0

COMMENTS
Due to the nature of the PHP project, development is very rapid and hence
many sites do not keep up with latest PHP versions. If a fix was available,
it would take quite a while to propagate.
It is likely that this is not an isolated problem in PHP, my bets are on
PostgreSQL and other PHP database extensions missing this one too.
The MySQL support has been enabled in PHP by default for as long as I can
remember.

DAVE WILSON
Currently residing in Belfast, Northern Ireland, he is available for work
relating to network security auditing, post-attack recovery and forensics,
and penetration testing. He may be contacted at [EMAIL PROTECTED]. If
you have any comments regarding this advisory, please contact him directly.

Sun Feb 3 21:23:03 GMT 2002 -dw



---
Outgoing mail is certified Virus Free By AVG Anti-Virus.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.319 / Virus Database: 178 - Release Date: 1/28/2002



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


[PHP] Re: PHP module build problem

2002-02-05 Thread Anas Mughal

I just saw a posting on PHPBuilder that states that
Apache 1.3.14 has changed alloc.h to ap_alloc.h. So,
file renaming is suggested.

Maybe that could fix the problem. (I will give it a
try...)

I would be open to any other suggestions...

Thanks.



--- Anas Mughal [EMAIL PROTECTED] wrote:
 I am trying to build PHP3 into apache 1.3.
 I have vanilla PHP and Apache sources.
 When I do the final Apache 'make', I get an error
 message complaining about not able to find target
 for
 alloc.h. The 'alloc.h' file is declared as a
 dependency for 'mod_php3.o' in the Makefile in
 folder
 'src/modules/php3'. 
 
 Any advice would be greatly helpful.
 
 =
 Anas Mughal
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 Tel: 973-249-6665
 
 __
 Do You Yahoo!?
 Send FREE Valentine eCards with Yahoo! Greetings!
 http://greetings.yahoo.com
 



=
Anas Mughal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Tel: 973-249-6665

__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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




[PHP] Check if var is a domain name

2002-02-05 Thread Brandon Orther

Hello,
 
Does anyone know a function or how I could make a function to check a
variable for being a valid domain name without the www. http://www./
 In fron of it?
 
Ex. $var = mynewdomain.com   that would be TRUE
 
Ex2. $var = www.mynewdomain.com   that would be FALSE
 
Ex3. $var = My Great Domain   that would be FALSE
 
And so on.
 
Does anyone have a function that makes sure there are no illegal
characters and there is a period in the middle of the text?
 
 
 
Brandon Orther 
WebIntellects Design/Development Manager
[EMAIL PROTECTED]
800-994-6364
www.webintellects.com

 



[PHP] What can I ask here?

2002-02-05 Thread Scott

Just want to make sure I am in the right forum...

I am new to PHP and will be doing alot of coding with it in the near future.

So I will be asking alot of newb questions...

Thanks,

Batch



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




Re: [PHP] What can I ask here?

2002-02-05 Thread Girish Nath

Hi

You'll find the mailing list archive an excellent source of info :

http://marc.theaimsgroup.com/?l=php-generalr=1w=2

Regards :)


Girish
--
www.girishnath.co.uk


- Original Message -
From: Scott [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 05, 2002 4:07 PM
Subject: [PHP] What can I ask here?


Just want to make sure I am in the right forum...

I am new to PHP and will be doing alot of coding with it in the near future.

So I will be asking alot of newb questions...

Thanks,

Batch



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



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




Re: [PHP] What can I ask here?

2002-02-05 Thread Jason Lotito

You can also find good information for PHP here:

www.phpdeveloper.org
www.phpbuilder.com
www.newbienetwork.net
www.phpbeginner.com
www.php.net // of course =)
www.devshed.com

Jason Lotito
Programmer  Developer
Clockmedia Inc.
Designing Tomorrow's Games, Today!
1-877-625-6256
514-908-2800
Fax: 514-908-2803

- Original Message -
From: Girish Nath [EMAIL PROTECTED]
To: Scott [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, February 05, 2002 11:18 AM
Subject: Re: [PHP] What can I ask here?


 Hi

 You'll find the mailing list archive an excellent source of info :

 http://marc.theaimsgroup.com/?l=php-generalr=1w=2

 Regards :)


 Girish
 --
 www.girishnath.co.uk


 - Original Message -
 From: Scott [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, February 05, 2002 4:07 PM
 Subject: [PHP] What can I ask here?


 Just want to make sure I am in the right forum...

 I am new to PHP and will be doing alot of coding with it in the near
future.

 So I will be asking alot of newb questions...

 Thanks,

 Batch



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



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



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




RE: [PHP] PHP / MYSQL security bug

2002-02-05 Thread James Cox

The PHP developers are aware of this, and are working with MySQL to make it
safer.

it should be noted that PHP safe mode, whilst making the environment
generally safer, is not an easy-answer to webserver security. The only real
solution is to learn about better security and configuration.

--james

--
James Cox :: [EMAIL PROTECTED]
Was I helpful?  http://www.amazon.co.uk/exec/obidos/wishlist/23IVGHQ61RJGO/

 -Original Message-
 From: Gerard Onorato [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 05, 2002 4:00 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP / MYSQL security bug


 Maybe I missed the thread but I was wondering if anyone has seen this
 report or done any testing on it.

 We tested it and it seems a pretty valid problem. Can anyone comment on a
 fix that may be in the works?

 Gerard

 --
 ---
 Security Advisory DW020203-PHP
 Release: 3rd February 2002
 PHP Safe Mode Filesystem Circumvention Problem
 Severity: Medium to high.
 Affects: PHP, all versions which include safe_mode feature.
 Platform: UNIX, Microsoft Windows, any platforms on which PHP is
 available.
 Vendor: http://php.net.
 Discovered: 12th January 2002, Dave Wilson [EMAIL PROTECTED], using
 PHP 4.1.0  Apache 2 on Linux.

 --
 

 VULNERABILITY IN BRIEF
 PHP (since version 3?) includes a commonly used feature known as
 Safe Mode.
 When enabled, scripts are highly limited in their ability to access or
 execute local files, among other things.
 PHP relies on a wrapper function around all filesystem calls to perform
 access checks, but unforunately the bundled MySQL client library has not
 been modified to perform such checks on LOAD DATA INFILE LOCAL
 statements.
 If an attacker has access to a MySQL server (either provided by you or
 himself), he can use it as a proxy by which to download files residing on
 the safe_mode-enabled web server. For large ISPs relying on this feature
 for individual customer privacy, it could mean clients accessing each
 other's files, or viewing of files on an improperly secured server.

 FIX
 Currently, no fix exists. You may use other PHP safe_mode functions to
 disable the use of the MySQL client library, or secure your servers in a
 proper fashion.. A suggested fix for the PHP developers might be to scan
 mysql_query()s for strings similar to LOAD DATA LOCAL INFILE.
 Happy hackers out there might like to look at libmysql.c:1764 if
 interested
 in fixing this problem, although that may only be possible from
 within PHP.

 EXAMPLE
 The attached script will (once configured correctly) attempt to read
 /var/log/lastlog via the SQL daemon and return it to the client.
 $ cp safe_mode.php /www
 $ wget -qO lastlog_via_mysql localhost/safe_mode.php
 $ diff /var/log/lastlog lastlog_via_mysql; echo $?
 0

 COMMENTS
 Due to the nature of the PHP project, development is very rapid and hence
 many sites do not keep up with latest PHP versions. If a fix was
 available,
 it would take quite a while to propagate.
 It is likely that this is not an isolated problem in PHP, my bets are on
 PostgreSQL and other PHP database extensions missing this one too.
 The MySQL support has been enabled in PHP by default for as long as I can
 remember.

 DAVE WILSON
 Currently residing in Belfast, Northern Ireland, he is available for work
 relating to network security auditing, post-attack recovery and forensics,
 and penetration testing. He may be contacted at [EMAIL PROTECTED]. If
 you have any comments regarding this advisory, please contact him
 directly.

 Sun Feb 3 21:23:03 GMT 2002 -dw



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




Re: [PHP] PHP / MYSQL security bug

2002-02-05 Thread Analysis and Solutions

Hi Folks:

Gerard Onorato wrote on the PHP-GENERAL mailing list:
 
 Security Advisory DW020203-PHP
 Release: 3rd February 2002
 PHP Safe Mode Filesystem Circumvention Problem

 ... snip ...

 FIX
 Currently, no fix exists. 
 ... snip ...
 A suggested fix for the PHP developers might be to scan
 mysql_query()s for strings similar to LOAD DATA LOCAL INFILE.

But they're forgetting about MySQL's permission handling.  The LOAD DATA
command can be controlled by the File_priv permission at the User level. 
Also, the Insert_priv can be regulated at many levels, including the User,
Database, table and column level.  Naturally, if one can't insert, there's no
way for them to run a LOAD DATA statement.

Enjoy,

--Dan

-- 
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409

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




Re: [PHP] Check if var is a domain name

2002-02-05 Thread Jeff Sheltren

Hi, I would use a regular expression to check it.  This is a pretty general 
one, but I think it should do the trick.  It searches for 1 or more upper 
or lowercase letters, followed by a literal dot, followed by 2 or 3 
lowercase letters.  Of course there are valid domains that would not match 
this (foobar.co.uk) for example, but it should work with the values you 
specified.

if (ereg(^[a-zA-Z]+\\.[a-z]{2,3}$, $var)) {
 // valid domain
}
else{
 // not valid
}

Jeff

At 07:59 AM 2/5/2002 -0800, Brandon Orther wrote:
Hello,

Does anyone know a function or how I could make a function to check a
variable for being a valid domain name without the www. http://www./
 In fron of it?

Ex. $var = mynewdomain.com   that would be TRUE

Ex2. $var = www.mynewdomain.com   that would be FALSE

Ex3. $var = My Great Domain   that would be FALSE

And so on.

Does anyone have a function that makes sure there are no illegal
characters and there is a period in the middle of the text?



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





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




Re: [PHP] Unable to get ImageTTFText output

2002-02-05 Thread Neil Freeman

Girish,

After a bit of searching around it appears that this is a bug of early
versions of PHP, re-introduced in PHP v4.0.6 (the version I was using). I have
upgraded to 4.10 and ImageTTFText now works fine.

Neil

Girish Nath wrote:

 Hi

 I had similar problems when just specifying the font file in the same
 directory eg ./arial.ttf but got it to work okay when i used the full path
 eg :

 $fontfile = /apache/htdocs/arial.ttf;

 ImageTTFText($im, 20, 0, 3, 3, $text_colour, $fontfile, My text);

 Regards

 Girish
 --
 www.girishnath.co.uk

 - Original Message -
 From: Neil Freeman [EMAIL PROTECTED]
 To: PHP General [EMAIL PROTECTED]
 Sent: Tuesday, February 05, 2002 2:59 PM
 Subject: [PHP] Unable to get ImageTTFText output

 Hi there,

 I am trying to use the ImageTTFText function to output some text onto an
 existing image. Problem being though that the text does not get
 outputted. I have placed the ttf file 'arial.ttf' within the same
 directory as my script. Here is a snippet of my code:

 Header(Content-Type: image/png);
 $im = ImageCreateFromPNG(original_image.png);

 $text_colour = ImageColorAllocate($im, 255, 255, 255);

 ImageTTFText($im, 20, 0, 3, 3, $text_colour, /arial.ttf, My
 text);

 ImagePNG($im);

 All this outputs is my original PNG image (with no text). I have used
 the following line instead of ImageTTFText and all works well.

 ImageString($im, 4, 3, 3, My text, $text_colour);

 Using phpinfo() I have checked the GD section and the following is
 outputted:

 GD Support - enabled
 GD Version - 2.0 or higher
 FreeType Support - enabled
 FreeType Linkage - with freetype
 JPG Support - enabled
 PNG Support - enabled
 WBMP Support - enabled

 Does anyone have any suggestions as to why this does not work? Has
 anyone else used the ImageTTFText function successfully?

 Neil
 
  Email:  [EMAIL PROTECTED]
  [EMAIL PROTECTED]
 

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

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

 ***
  This message was virus checked with: SAVI 3.53 Jan 2002
  last updated 30th January 2002
 ***

--

 Email:  [EMAIL PROTECTED]
 [EMAIL PROTECTED]




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




Re: [PHP] What can I ask here?

2002-02-05 Thread Dave

Don't forget about

www.phpguru.org
www.hotscripts.com

Two other great sites for information and sample scripts.

Dave

Jason Lotito [EMAIL PROTECTED] wrote in message
037201c1ae61$b7e25a10$3b0a@JASON">news:037201c1ae61$b7e25a10$3b0a@JASON...
 You can also find good information for PHP here:

 www.phpdeveloper.org
 www.phpbuilder.com
 www.newbienetwork.net
 www.phpbeginner.com
 www.php.net // of course =)
 www.devshed.com

 Jason Lotito
 Programmer  Developer
 Clockmedia Inc.
 Designing Tomorrow's Games, Today!
 1-877-625-6256
 514-908-2800
 Fax: 514-908-2803

 - Original Message -
 From: Girish Nath [EMAIL PROTECTED]
 To: Scott [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Tuesday, February 05, 2002 11:18 AM
 Subject: Re: [PHP] What can I ask here?


  Hi
 
  You'll find the mailing list archive an excellent source of info :
 
  http://marc.theaimsgroup.com/?l=php-generalr=1w=2
 
  Regards :)
 
 
  Girish
  --
  www.girishnath.co.uk
 
 
  - Original Message -
  From: Scott [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, February 05, 2002 4:07 PM
  Subject: [PHP] What can I ask here?
 
 
  Just want to make sure I am in the right forum...
 
  I am new to PHP and will be doing alot of coding with it in the near
 future.
 
  So I will be asking alot of newb questions...
 
  Thanks,
 
  Batch
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 




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




Re: [PHP] add value to serialized array?

2002-02-05 Thread Bas Jobsen

Hello,

OKay, when i replace the last rows with:

$fp=fopen(test.txt,r);
flock($fp,1);
$array=array_merge($array,unserialize(fread($fp,filesize(test.txt;
flock($fp,3);
fclose($fp);

it works.

But now i want to place this in a class, and it goes wrong again.

Hope you can help, thanks,

Bas
 
--
?
class test
{

function test(){;}  

function read()
{
$array=array();
$fp=fopen(test.txt,r);
flock($fp,1);
$array=unserialize(fread($fp,filesize(test.txt)));
flock($fp,3);
fclose($fp);
return $array;
}

function save($array)
{
$fp=fopen(test.txt,w+);
flock($fp,2);
fwrite($fp,serialize($array));
flock($fp,3);
fclose($fp);
}

function push($array,$value)
{
array_push($array,$value);
$this-save($array);
}

}
$test= new test;

$array=$test-read();

echo $array[0].$array[1].$array[2];

$test-push($array,three);
//$test-save($array);

$array=$test-read();

echo $array[0].$array[1].$array[2];

?
--



Op dinsdag 05 februari 2002 12:24, schreef u:
 Hi,

 At start test.txt contains a serialized array with value one and two.
 a:2:{i:0;s:3:one;i:1;s:3:two;}
 after one run this is:
 a:3:{i:0;s:3:one;i:1;s:3:two;i:2;s:4:tree;}

 But the last row prints nothing. Why?

 Tnx,

 Bas

 ?
 $array=array();
 $fp=fopen(test.txt,r);
 flock($fp,1);
 $array=unserialize(fread($fp,filesize(test.txt)));
 flock($fp,3);
 fclose($fp);

 array_push($array,tree);

 $fp=fopen(test.txt,w+);
 flock($fp,2);
 fwrite($fp,serialize($array));
 flock($fp,3);
 fclose($fp);

 $fp=fopen(test.txt,r);
 flock($fp,1);
 $array=unserialize(fread($fp,filesize(test.txt)));
 flock($fp,3);
 fclose($fp);

 echo $array[0].$array[1].$array[2];
 ?

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




Re: [PHP] Problem...header already sent by

2002-02-05 Thread Peter Ruan

Hi Jason,
  Yeap, I ran 'phpinfo()' Server API=CGI.  I look at the manual and you are
right, I must run it as Apache module.  Can someone tell me how do I change
the setting to run as an APACHE module instead?

Thanks,
-Peter

Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 On Tuesday 05 February 2002 15:20, Peter wrote:
  Hi Ryan,
Thanks for the examples.  Okay, I deleted the other stuff and just put
  this code and I get this from
  my interpreter?  Is this a setting problem?


 Are you running PHP as a CGI? If so, what you want to do cannot be done.
See
 chapter HTTP authentication with PHP.


 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk

 /*
 You will triumph over your enemy.
 */



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




Re: [PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Jason Wong

On Wednesday 06 February 2002 00:03, Edward R. Bailey wrote:
 Hi,

 I am working on a page the displays the output of a query in a table and
 I only want to show the field labels that have corresponding output from
 the database. I am only really concerned with the last label in the
 table.

 The label is called Notes and the corresponding field in the database
 is memberNotes

 So I wrote the following script where I think I am saying if memberNotes
 returns any value then print the output of $notes in the table cell
 where it is called, but nothing happens and the output of $notes is not
 displayed regardless whether memberNotes has any output.

 ?php If ($memberNotes =='1') {

What is $memberNotes supposed to contain? If it is supposed to contain notes 
on members then surely it can't be '1' all the time?

I think you probably want:

  if ($memberNotes) { ...



hth
-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Where is John Carson now that we need him?
-- RLG
*/

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




Re: [PHP] Problem...header already sent by

2002-02-05 Thread Jason Wong

On Wednesday 06 February 2002 01:52, Peter Ruan wrote:
 Hi Jason,
   Yeap, I ran 'phpinfo()' Server API=CGI.  I look at the manual and you are
 right, I must run it as Apache module.  Can someone tell me how do I change
 the setting to run as an APACHE module instead?

Well, you don't change the setting as such. On a Linux system you would've 
have to recompile PHP and possibly Apache as well. On a Windows system you 
would probably just download the relevant files and install.


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
linux: because a PC is a terrible thing to waste
([EMAIL PROTECTED] put this on Tshirts in '93)
*/

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




Re: [PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Jason Wong

On Wednesday 06 February 2002 02:14, Edward R. Bailey wrote:

Please keep the discussion on the list!

 Thanks for responding! Yes the memberNotes database field only
 contains information in about a third of the records so I wanted to hide
 the entire field and label when their was no relevent data.

 I made the change you suggested, but the field label does not show up
 when memberNotes contains data. As follows is the current script. Is
 what what you suggested?


 ?php If ($memberNotes) {
 $notes = div align=\/left\/font
 size=\/-1\/bNotes:/b/font/div;
   } else {
 $notes = div align=\/left\/font
 size=\/-1\/b/b/font/div;
   }
 ?

What are those forward slashes (/) doing in $notes? Try getting rid of them, 
they don't look very HTML to me :)

Also try echo($notes) OUTSIDE of a table construct to see what it contains.


hth
-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Q:  What do Winnie the Pooh and John the Baptist have in common?
A:  The same middle name.
*/

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




RE: [PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Edward R. Bailey

I used echo($notes) at the bottom of the page and the output of $notes
prints reardless of whether or not the db field $memberNotes contains
any data. It seems to me that $notes is always acting as if $memberNotes
always contains data. Is their some way to invoke $notes only if
$memberNotes returns any data?

Thanks for your help,
ED



 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, February 05, 2002 1:22 PM
 To: PHP General Mailing List
 Subject: Re: [PHP] Easy Question -- Show/ Hide text based on 
 output of query
 
 
 On Wednesday 06 February 2002 02:14, Edward R. Bailey wrote:
 
 Please keep the discussion on the list!
 
  Thanks for responding! Yes the memberNotes database field only 
  contains information in about a third of the records so I wanted to 
  hide the entire field and label when their was no relevent data.
 
  I made the change you suggested, but the field label does 
 not show up 
  when memberNotes contains data. As follows is the current 
 script. Is 
  what what you suggested?
 
 
  ?php If ($memberNotes) {
  $notes = div align=\/left\/font 
  size=\/-1\/bNotes:/b/font/div;
} else {
  $notes = div align=\/left\/font 
  size=\/-1\/b/b/font/div;
}
  ?
 
 What are those forward slashes (/) doing in $notes? Try 
 getting rid of them, 
 they don't look very HTML to me :)
 
 Also try echo($notes) OUTSIDE of a table construct to see 
 what it contains.
 
 
 hth
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 
 /*
 Q:What do Winnie the Pooh and John the Baptist have in common?
 A:The same middle name.
 */
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Jason Wong

On Wednesday 06 February 2002 02:38, Edward R. Bailey wrote:
 I used echo($notes) at the bottom of the page and the output of $notes
 prints reardless of whether or not the db field $memberNotes contains
 any data. It seems to me that $notes is always acting as if $memberNotes
 always contains data. Is their some way to invoke $notes only if
 $memberNotes returns any data?


Please post your full code.


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
I go on working for the same reason a hen goes on laying eggs.
- H. L. Mencken
*/

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




RE: [PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Edward R. Bailey

Sorry -- Here it is


 ?php If ($memberNotes) {
 $notes = div align=leftfont
size=-1bNotes:/b/font/div;
   } else {
 $notes = ;
   }
 ?

Then I call $notes using --

echo ($notes)

 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, February 05, 2002 1:39 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Easy Question -- Show/ Hide text based on 
 output of query
 
 
 On Wednesday 06 February 2002 02:38, Edward R. Bailey wrote:
  I used echo($notes) at the bottom of the page and the 
 output of $notes 
  prints reardless of whether or not the db field 
 $memberNotes contains 
  any data. It seems to me that $notes is always acting as if 
  $memberNotes always contains data. Is their some way to 
 invoke $notes 
  only if $memberNotes returns any data?
 
 
 Please post your full code.
 
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 
 /*
 I go on working for the same reason a hen goes on laying eggs.
 - H. L. Mencken
 */
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Jason Wong

On Wednesday 06 February 2002 02:53, Edward R. Bailey wrote:
 Sorry -- Here it is


  ?php If ($memberNotes) {
  $notes = div align=leftfont
 size=-1bNotes:/b/font/div;
} else {
  $notes = ;
}
  ?

 Then I call $notes using --

 echo ($notes)

I meant your *whole* script -- never mind, have you tried echo($memberNotes) 
to see what that contains? Are you sure it doesn't contain spaces or other 
non-visible characters?


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
All language designers are arrogant.  Goes with the territory...
(By Larry Wall)
*/

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




[PHP] Links to other pages

2002-02-05 Thread Morten Nielsen

Hi,

I have a link on my page that looks like this:

$CFG-dirroot= f:/Inetpub/wwwroot/mymarket2;
a href=?=$CFG-dirroot?/login.phpLogin/a

The link is displayed right on my page, but when I press it a dialog box is
saying that I am downloading the php file and wether I want to open or save
it.
Can anybody tell me what is wrong?

Thanks,
Morten



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




RE: [PHP] Easy Question -- Show/ Hide text based on output of query

2002-02-05 Thread Edward R. Bailey

Thanks for all your help, but I figured out what I did wrong

I was calling the memberNotes field using

 echo $get_detail-Fields(memberNotes) 

so when I replaced $memberNotes in the script with
$get_detail-Fields(memberNotes) it worked like a charm

 If ($get_detail-Fields(memberNotes)) {
 $notes = div align=leftfont
size=-1bNotes:/b/font/div;
} else {
 $notes = ;
}

Dumb error on my part. 

Thank you very much for your patience,

Ed


 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, February 05, 2002 1:53 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Easy Question -- Show/ Hide text based on 
 output of query
 
 
 On Wednesday 06 February 2002 02:53, Edward R. Bailey wrote:
  Sorry -- Here it is
 
 
   ?php If ($memberNotes) {
   $notes = div align=leftfont 
  size=-1bNotes:/b/font/div;
 } else {
   $notes = ;
 }
   ?
 
  Then I call $notes using --
 
  echo ($notes)
 
 I meant your *whole* script -- never mind, have you tried 
 echo($memberNotes) 
 to see what that contains? Are you sure it doesn't contain 
 spaces or other 
 non-visible characters?
 
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 
 /*
 All language designers are arrogant.  Goes with the 
 territory... (By Larry Wall) */
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] Problem...header already sent by

2002-02-05 Thread Peter Ruan

Ryan,
   I just tried it with my Linux box and I get the authentication 
box...which is good sign.  So it looks like a PHP in MS Windows (the 
'fabulous' windows) setting which from the error.log file indicates as well.

/** error message listed in error.log **/
[Mon Feb 04 22:36:30 2002] [error] [client 127.0.0.1] malformed header 
from script. Bad header=HTTP/1.0 401 Unauthorized: /apache/php/php.exe


In looks like a setting problem in some .ini file.  Do you know how to 
correct this problem?

Thanks for the help!
-Peter






Ryan F. Bayhonan wrote:

 It will work as expected Peter.
 
 ?php
 header (WWW-authenticate: Basic realm=\Private\);
 header (HTTP/1.0 401 Unauthorized);
 echo Unauthorized;
 exit;
 ?
 
 So where do we go from here??
 
 Ryan
 
 
 


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




RE: [PHP] Re: Changes in Sessions (PHP Versions)

2002-02-05 Thread Travis Simpson

Hey,

I changed it from:

$HTTP_SESSION_VARS[$key] = $value;

To:

session_register($key);
$key = $value;

And now it works fine.

At first, when I wrote the $key = $value... It made no sense... I was
just doing it because I didn't know what else to try. And it actually
works ;) I figured it would set the variable $key to the value of
$value. But it didn't. It created a new variable. Naming it the value of
$key. And giving that new variable the value of $value.

Does this confuse anybody else?? ;)

Thanks for all your help,
-Travis

-Original Message-
From: Yasuo Ohgaki [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 05, 2002 2:33 AM
To: Travis Simpson
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Changes in Sessions (PHP Versions)


If you really need to use 4.0.6, try to use different
session save handler and/or serializer. Try WDDX
serializer at first, then try verious combinations.

If you use other save handler/serializer, it may work.
I suggest you to upgrade, though...

--
Yasuo Ohgaki


Travis Simpson wrote:
 Sorry, I probably worded my question wrong.
 
 I am creating a 10 step (or so) form that is non-linear... The user
 enters all of their information and is able to go back and change
 information that they have filled in. So I have the form (POST)
 information set into session variables as soon as they click Next in
 the form. Well, with 4.1.1 there were no problems... It ALL worked
 perfectly. But unfortunately, in 4.0.6 it doesn't act the same.
 
 I just have a foreach loop go through all the POST variables and make
 them into SESSION variables,
 
 --- Snippet ---
 start_session();
 foreach ($HTTP_POST_VARS as $key = $value) {
   $HTTP_SESSION_VARS[$key] = $value;
 }
 --- End Snippet ---
 
 Easy enough... Now, I have all the 10 steps linked to on the side bar.
 a href=step1.php?PHPSESSID=$PHPSESSIDStep 1/a
 
 But for some weird reason, those links BLANK all the session
variables.
 I tested this by doing a count() on the HTTP_SESSION_VARS array. And
as
 soon as I click one of the Step links on the side, it clears all of
 them. I am not sure if I am doing this wrong, but it works fine (as I
 said) in 4.1.1.
 
 Another problem that I seem to be having... Is that 4.0.6 almost seems
 like it is maxing out with a certain number of SESSION variables. Once
 it has so many, it just starts over.
 
 I will just post the link here tomorrow, unfortunately I don't have
the
 files on this computer.
 
 I hope this is a little more clear.
 
 Thanks,
 -Travis
 
 
 
 -Original Message-
 From: Yasuo Ohgaki [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, February 04, 2002 6:11 PM
 To: [EMAIL PROTECTED]; Travis Simpson
 Subject: [PHP] Re: Changes in Sessions (PHP Versions)
 
 
 Travis Simpson wrote:
 
Hey,

I am just wondering if there were any changes done to the session 
engine or settings between PHP 4.0.6 and 4.1.1.

I have been getting nothing but grief from 4.0.6 and 4.1.1 seems to 
work fine.


 
 
 What did work with 4.0.6 and what didn't with 4.1.1?
 
 If you are trying to use mm/msession save handler, it's broken
somewhat.
 
 


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


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




[PHP] HowTo Send HTTP POST from Within Scrip

2002-02-05 Thread Gabriel Richards

Hi eveyone.

I'm trying to build an application to interface with UPS Online Tools
server. I have to send it an XML formatted request via HTTP POST, and I'm
not sure how.

Normally, PHP receives such requests when a user clicks a button on a form I
created, but how do I initiate a POST from with a script? Better yet, how do
I get the response?

Thanks for help!
Gabe

-
Ender Technology Corp.
Websites, Database Applications, Hosting
(310) 516-7411
[EMAIL PROTECTED]
http://www.endertechnology.com/

-
Ender Technology Corp.
Websites, Database Applications, Hosting
(310) 516-7411
[EMAIL PROTECTED]
http://www.endertechnology.com/



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




[PHP] Re: Links to other pages

2002-02-05 Thread Mike Frazer

You're server will only parse PHP files that come from your server's doot
cirectory or one of the virtualhost root directories, and then only when
called through the right protocol.  If you call a file directly from a drive
(in this case, F), you aren't accessing it through the server, and therefore
are not parsing the file because the server never sees it.

The reason standard HTML works that way is because HTML is browser parsed.
The browser makes the decision.  PHP is server-parsed, and then sends across
the correct headers to force the browser into printing the output as HTML or
XML or whatever is being sent.

Try changing your $CFG-dirroot to a values based on your server root or a
vhost root (for whichever site the script below is for).

Mike Frazer



Morten Nielsen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 I have a link on my page that looks like this:

 $CFG-dirroot= f:/Inetpub/wwwroot/mymarket2;
 a href=?=$CFG-dirroot?/login.phpLogin/a

 The link is displayed right on my page, but when I press it a dialog box
is
 saying that I am downloading the php file and wether I want to open or
save
 it.
 Can anybody tell me what is wrong?

 Thanks,
 Morten





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




Re: [PHP] Check if var is a domain name

2002-02-05 Thread Mike Frazer

Your reg-ex wouldn't quite work.  Remember, .info, .name, .coop and other
new TLDs are out or are coming out soon.  A limit of {2,3} would rule them
all out as invalid.

It's only really possible if you have a list of all available TLDs and
compare in part to that.  There are like 130 TLDs too, so it's not the most
practical thig in the world.

Mike Frazer




Jeff Sheltren [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi, I would use a regular expression to check it.  This is a pretty
general
 one, but I think it should do the trick.  It searches for 1 or more upper
 or lowercase letters, followed by a literal dot, followed by 2 or 3
 lowercase letters.  Of course there are valid domains that would not match
 this (foobar.co.uk) for example, but it should work with the values you
 specified.

 if (ereg(^[a-zA-Z]+\\.[a-z]{2,3}$, $var)) {
  // valid domain
 }
 else{
  // not valid
 }

 Jeff

 At 07:59 AM 2/5/2002 -0800, Brandon Orther wrote:
 Hello,
 
 Does anyone know a function or how I could make a function to check a
 variable for being a valid domain name without the www. http://www./
  In fron of it?
 
 Ex. $var = mynewdomain.com   that would be TRUE
 
 Ex2. $var = www.mynewdomain.com   that would be FALSE
 
 Ex3. $var = My Great Domain   that would be FALSE
 
 And so on.
 
 Does anyone have a function that makes sure there are no illegal
 characters and there is a period in the middle of the text?
 
 
 
 Brandon Orther
 WebIntellects Design/Development Manager
 [EMAIL PROTECTED]
 800-994-6364
 www.webintellects.com
 
 





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




RE: [PHP] Re: Changes in Sessions (PHP Versions)

2002-02-05 Thread Johnson, Kirk

This suggests that register_globals was set to 'off' in the first case and
'on' in the second case. The lines below are perfect examples of how to
change the code when changing the register_globals setting in php.ini.

Kirk

 -Original Message-
 From: Travis Simpson [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 05, 2002 12:08 PM
 To: [EMAIL PROTECTED]
 Cc: 'Yasuo Ohgaki'
 Subject: RE: [PHP] Re: Changes in Sessions (PHP Versions)
 
 
 Hey,
 
 I changed it from:
 
 $HTTP_SESSION_VARS[$key] = $value;
 
 To:
 
 session_register($key);
 $key = $value;
 
 And now it works fine.

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




RE: [PHP] HowTo Send HTTP POST from Within Scrip

2002-02-05 Thread Johnson, Kirk

Search the archives on PostToHost, or also go here:

http://www.zend.com/zend/spotlight/mimocsumissions.php#Heading6
http://marc.theaimsgroup.com/?l=php-generalm=92353052714384w=2

I think if you also search on UPS you will find discussion of this exact
problem.

Good luck!

Kirk

 -Original Message-
 From: Gabriel Richards [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 05, 2002 12:42 PM
 To: PHP General
 Subject: [PHP] HowTo Send HTTP POST from Within Scrip
 
 
 Hi eveyone.
 
 I'm trying to build an application to interface with UPS Online Tools
 server. I have to send it an XML formatted request via HTTP 
 POST, and I'm
 not sure how.
 
 Normally, PHP receives such requests when a user clicks a 
 button on a form I
 created, but how do I initiate a POST from with a script? 
 Better yet, how do
 I get the response?
 
 Thanks for help!
 Gabe
 
 -
 Ender Technology Corp.
 Websites, Database Applications, Hosting
 (310) 516-7411
 [EMAIL PROTECTED]
 http://www.endertechnology.com/
 
 -
 Ender Technology Corp.
 Websites, Database Applications, Hosting
 (310) 516-7411
 [EMAIL PROTECTED]
 http://www.endertechnology.com/
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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




[PHP] Re: HowTo Send HTTP POST from Within Scrip

2002-02-05 Thread Julio Nobrega Trabalhando

  It's usually done with fsockopen();, and curl module functions for SSL
servers. There are a few classes for each method, on the most tradicional
snippets and clasess websites.

  I enjoyed using one called Snoopy. Also the manual pages comments are very
helpful (both on fsockopen(); related functions and curl module ones).

--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca

Gabriel Richards [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi eveyone.

 I'm trying to build an application to interface with UPS Online Tools
 server. I have to send it an XML formatted request via HTTP POST, and I'm
 not sure how.

 Normally, PHP receives such requests when a user clicks a button on a form
I
 created, but how do I initiate a POST from with a script? Better yet, how
do
 I get the response?

 Thanks for help!
 Gabe

 -
 Ender Technology Corp.
 Websites, Database Applications, Hosting
 (310) 516-7411
 [EMAIL PROTECTED]
 http://www.endertechnology.com/

 -
 Ender Technology Corp.
 Websites, Database Applications, Hosting
 (310) 516-7411
 [EMAIL PROTECTED]
 http://www.endertechnology.com/





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




[PHP] Duplicate e-mails

2002-02-05 Thread Anthony Rodriguez

The following php script sends two (2) e-mails to each addressee.  Why?

?php

$connection=mysql_connect(localhost,wagner,XXX) or die (No 
connection!);

$db=mysql_select_db(sbwresearch,$connection) or die (No database!);

$message= Dear consumer,\n
The following are the online surveys ...  etc.\n;

$qry_1=select * from con_inf;

$result_1=mysql_query($qry_1,$connection) or die (No query # 1!);

while ($row_1=mysql_fetch_array($result_1, MYSQL_ASSOC))

{
$e_mail=$row_1[e_mail];
mail($e_mail,
  News from SBW Research,
  $message,
  From:SBW Research [EMAIL PROTECTED]\n);
};

mysql_free_result($result_1);

mysql_close($connection);

header (location:done.htm);

exit;

?

Anthony Rodriguez
([EMAIL PROTECTED])


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




[PHP] Books on PHP

2002-02-05 Thread Ronald D Wahlen

Hello,

I am new to PHP and was wondering if anyone can point me the right direction
with
PHP urls and books to learn how to develop web sites using PHP. I read some
of the information on www.php.net web site and have the PHP Bible.

Thanks,
Ron





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




Re: [PHP] Duplicate e-mails

2002-02-05 Thread Analysis and Solutions

Hi Anthony:

Anthony Rodriguez wrote:
 
 The following php script sends two (2) e-mails to each addressee.  Why?

I'll bet the email addresses in question are listed in the table twice.  Open
up a MySQL command line prompt and enter select * from con_inf; to make
sure.  To keep this from happening, you can delete the duplicates then add a
unique index on the e_mail field in the MySQL table definition.


 $qry_1=select * from con_inf;

Side Issue 1:  why are you selecting everything (via *) rather than just
e_mail, since that's all you're using in the script?


 $result_1=mysql_query($qry_1,$connection) or die (No query # 1!);
 
 while ($row_1=mysql_fetch_array($result_1, MYSQL_ASSOC))
 
 {
 $e_mail=$row_1[e_mail];
 mail($e_mail,

Side Note 2:  You can combiune those two lines into one:
   mail($row_1['e_mail'],


 mysql_free_result($result_1);
 mysql_close($connection);

Side Note 3:  You don't worry about these commands in scripts you're about to
exit anyway.

Enjoy,

--Dan

-- 
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409

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




RE: [PHP] Books on PHP

2002-02-05 Thread Kevin Stone

I got started with a book called, PHP and MySQL Web Development by
Luke Welling and Laura Thomson, published by SAMS.   This book is
clearly written with the self-taught programmer in mind, tearing apart
numerous real-world examples and explaining relevant concepts in depth.
It does not go into theory or advanced topics making it a terrible book
for the experienced programmer.  It is also not a good function
reference.  But far as reference goes, I say forget the books.  Nothing
can beat the function search at www.php.net.

--
Kevin Stone
[EMAIL PROTECTED]
www.helpelf.com

 -Original Message-
 From: Ronald D Wahlen [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 05, 2002 2:07 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Books on PHP
 
 Hello,
 
 I am new to PHP and was wondering if anyone can point me the right
 direction
 with
 PHP urls and books to learn how to develop web sites using PHP. I read
 some
 of the information on www.php.net web site and have the PHP Bible.
 
 Thanks,
 Ron
 
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




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




[PHP] Re: whic OS is under?

2002-02-05 Thread LaserJetter

There is something. Its one of the enironment vars I think.  Look for UNAME
or U something.
I'm not sure if this gives the current OS or the OS on which PHP was
compiled though.



Ivo Stoykov [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi group:

 Is there a way to guess which OS the script is running? I couldn't find
 anything in the manual about this.

 Thank you

 Ivo





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




[PHP] File Upload -- File Trailer Partial

2002-02-05 Thread Richard Lynch

Please Cc: me -- I can't keep up with anything like the full volume 
of PHP-General any more and have only lurked for quite some time :-(

I'm consistently seeing file uploads get only the trailing N bytes of 
the file if the file is over a certain size.

This is on applications that worked flawlessly under previous 
versions on the old ISP, but I had to start using 
http://php.net/move_uploaded_file and working around/through safe 
mode on the new ISP.

The limit does *NOT* seem to be a constant, but perhaps the ISP's 
attempt to alter the File Upload Limit has affected this over time...

I guess I'm seeking reassurance that:

A) File upload not known to be broken
B) move_uploaded_file completely finishes and CLOSES a file before returning

The variance in the amount of data succesfully acquired feels like 
move_uploaded_file is leaving the file open, and then I fopen() it, 
and get the latter half of the file due to file-pointer cross-wiring 
or something.

Here is the top bit of phpinfo():
PHP Version 4.2.0-dev

System  OpenBSD o2 2.9 conf#0 i386
Build Date  Jan 29 2002 15:56:06
Configure Command'./configure' 
'--with-apache=../apache_1.3.22' 
'--with-config-file-path=/var/www/conf' '--enable-trans-sid' 
'--enable-ftp' '--enable-sockets' '--with-openssl' '--with-gd' 
'--with-jpeg-dir=/usr/local/lib' '--with-png-dir=/usr/local/lib' 
'--with-tiff-dir=/usr/local/lib' '--with-zlib-dir=/usr/include' 
'--with-mysql' '--with-pdflib' '--with-mcrypt' 
'--with-pgsql=/usr/local'
Server API  Apache
Virtual Directory Support   disabled
Configuration File (php.ini) Path   /var/www/conf/php.ini
ZEND_DEBUG  disabled
Thread Safety   disabled
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.2.0, Copyright (c) 1998-2002 Zend Technologies
-- 
Got Music? http://l-i-e.com/artists.htm

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




[PHP] POST to SSL Server without CURL?

2002-02-05 Thread Gabriel Richards

Thank you for your very helpful guidance to this point!

My host doesn't have the CURL module installed and it is unlikely they will
do it (PHP running on NT).

Apparently I can't just fsockopen(www.ups.com, 443); ???

Is there another way?

Gabe



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




Re: [PHP] whic OS is under?

2002-02-05 Thread Lars Torben Wilson

On Mon, 2002-02-04 at 05:45, Ivo Stoykov wrote:
 Hi group:
 
 Is there a way to guess which OS the script is running? I couldn't find
 anything in the manual about this.
 
 Thank you
 
 Ivo

The constant PHP_OS will tell you. For a list of all currently 
defined constants, try http://www.php.net/get_defined_constants.


Hope this helps,

Torben

-- 
 Torben Wilson [EMAIL PROTECTED]
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


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




[PHP] mktime() problem

2002-02-05 Thread toni baker

How can I make sure the user enters a date in format
mm/dd/ and the date must be between the year 1600
and 2038.

The script below meets the criterion above, except
mktime() or strtotime() does not validate year 1600
dates.  Any suggestions?  Thanks
 
$dateparts = explode('/', $Date);
$month = $dateparts[0];
$day = $dateparts[1];
$year = $dateparts[2];
$date1 = date (m/d/Y, mktime
(0,0,0,$month,$day,$year));
if (!$Date) {
  $submit = 0;
  $Date = BDate Required/B;
}
elseif (!checkdate($month,$day,$year)) {
  $submit = 0;
  $Date = BInvalid Date/B;
}
elseif ($Date != $date1) {
  $submit = 0;
  $Date = BInvalid Date/B;
}
elseif ($year  1600 || $year  2030) {
  $submit = 0;
  $Date = BInvalid Date/B;
}  

  

__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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




[PHP] How do I display variables in text boxes when the value of a drop down menu changes?

2002-02-05 Thread Don

Hi,

I have a PHP script that displays a form.  On one section of the form, there is a drop 
down menu followed by a few text boxes.  I'd like to alter the values of the text 
boxes when the user changes the selection in the dropdown menu.

What I've done is create 10 arrays (the drop down menu has 10 items hence one array 
per item).  Each time the user changes the selection in the drop down menu, I figure 
I'd:

a) save the current variables to the array corfresponding to the old selection
b) fill the text boxes with vales of the array corresponding to the new selection

Is this possible using PHP?  I figure that since PHP is server side, I will have to 
use JavaScript to provide some of the functionality I require but how do I set and 
access PHP variables from JavaScript?

If the above is not workable, Is there another way I can accomplish this?

Thanks in advance,
Don



[PHP] Re: Books on PHP

2002-02-05 Thread Manuel Lemos

Hello,

Ronald D Wahlen wrote:
 
 Hello,
 
 I am new to PHP and was wondering if anyone can point me the right direction
 with
 PHP urls and books to learn how to develop web sites using PHP. I read some
 of the information on www.php.net web site and have the PHP Bible.

Look here for a long list of books with some reviewed.

http://phpclasses.UpperDesign.com/products.html

Regards,
Manuel Lemos

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




[PHP] date(), time() different to system time

2002-02-05 Thread Anth Courtney

Hey guys,

I'm running a RH7.2 box with apache 1.3.20 installed and php-4.1.1
installed as a DSO.

Everything is working fine, except that the output from any date() or
time() references is 16 hours behind the system time (and hwtime) on the
machine.

The machine gets its time from an ntp server which is correct; this setup
is similar for other boxes on the network which have no problems with the
date or time in php being correct.

If I output date('T') then the correct timezone (EST...I'm in Aus) is
displayed, but any time or dates are 16 hours behind.

Where does php read the time/date values from? Is there something I can
tweak or something that I should look at to correct this? I know I could
kludge around it in users php code by tacking an extra 16 hours onto each
value but obviously that's not a good solution for a box which will be
used by others!

Any thoughts / headsup would be appreciated.

cheers,
Anth

--
  Anth Courtney - Systems Administrator / Programmer
[EMAIL PROTECTED] - PLANET NETCOM - www.pnc.com.au
--




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




RE: [PHP] How do I display variables in text boxes when the value of a drop down menu changes?

2002-02-05 Thread Martin Towell

to access php var in javascript, you'll need to set up javascript vars
with the values of the php vars you want to use.

eg.

?
  $foobar = testing;
?
script
  alert(foobar);  // will display nothing - not set yet
  foobar = ?= $foobar; ?;
  alert(foobar);  // now will display testing
/script

remember, to get the vars back to php, you'll need to make a request to the
server using one of serveral methods

hope that helps
Martin

-Original Message-
From: Don [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 06, 2002 9:00 AM
To: php list
Subject: [PHP] How do I display variables in text boxes when the value
of a drop down menu changes?


Hi,

I have a PHP script that displays a form.  On one section of the form, there
is a drop down menu followed by a few text boxes.  I'd like to alter the
values of the text boxes when the user changes the selection in the dropdown
menu.

What I've done is create 10 arrays (the drop down menu has 10 items hence
one array per item).  Each time the user changes the selection in the drop
down menu, I figure I'd:

a) save the current variables to the array corfresponding to the old
selection
b) fill the text boxes with vales of the array corresponding to the new
selection

Is this possible using PHP?  I figure that since PHP is server side, I will
have to use JavaScript to provide some of the functionality I require but
how do I set and access PHP variables from JavaScript?

If the above is not workable, Is there another way I can accomplish this?

Thanks in advance,
Don



[PHP] MySQL selecting the maximum value from a column

2002-02-05 Thread Melanie Gann

Thank you all you listeners out there. I'll try to be respectful of your
time and patience, and apoligize in advance for my greeness - I am 2
weeks into PHP/MySQL.

I am trying to select the higest value from the column Thought_Num below.
But it returns nothing. 

?PHP
$db = mysql_connect(localhost, root);
mysql_select_db(DynaSite,$db);
$result = mysql_query(SELECT MAX(Thought_Num) FROM quotes,$db);
$myrow = mysql_fetch_array($result);
print the result is $myrow[Thought_Num];
?

If I change my select to something that without the MAX (e.g. Select from
quotes where DocID=1), the code works fine. 

Thanks in advance for your help.

Regards,
Melanie


Second Street Web Design
http://www.second-street.com



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




RE: [PHP] MySQL selecting the maximum value from a column

2002-02-05 Thread Martin Towell

what happens if you do this?

$result = mysql_query(SELECT MAX(Thought_Num) as Thought_Num FROM
quotes,$db);

I'm thinking that the column name in your original query is being called
MAX(Thought_Num) and not Thought_Num.

Martin

-Original Message-
From: Melanie Gann [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 06, 2002 10:12 AM
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL selecting the maximum value from a column


Thank you all you listeners out there. I'll try to be respectful of your
time and patience, and apoligize in advance for my greeness - I am 2
weeks into PHP/MySQL.

I am trying to select the higest value from the column Thought_Num below.
But it returns nothing. 

?PHP
$db = mysql_connect(localhost, root);
mysql_select_db(DynaSite,$db);
$result = mysql_query(SELECT MAX(Thought_Num) FROM quotes,$db);
$myrow = mysql_fetch_array($result);
print the result is $myrow[Thought_Num];
?

If I change my select to something that without the MAX (e.g. Select from
quotes where DocID=1), the code works fine. 

Thanks in advance for your help.

Regards,
Melanie


Second Street Web Design
http://www.second-street.com



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



RE: [PHP] Can anyone jog my memory on HTTP_REFERER Javascript location:replace?

2002-02-05 Thread Lazor, Ed

If I understand what I think you're asking, you're trying to access the
results in Javascript of something the PHP script processed... use your php
script to spit out some javascript.  For example:

print script language='javascript'\n;
print $Result = .$Results.;\n;
print /script;



-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 2:09 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Can anyone jog my memory on HTTP_REFERER  Javascript
location:replace?


Hi!

I had found a way around the problem and it work, but when I enabled the
web security features, it messed up.  So, with some debugging and I found
the problem and I'm not sure how to find a way around it.  You see 

I use page1.php to do certain features but the problem is that PHP
execution get done before the file (non-PHP programming) in passthru('...')
get done later.  So, I can't get the result before PHP finish executing.
There, I came up with the Javascript where the non-PHP scripting can spit
out the Javascript code and the Javascript take care of it.  It work so
well.  To my dismay, the PHP pick up the HTTP_REFERER doesn't work because
HTTP_REFERER was all blank when Javascript use location.replace(''); code.
So, it messed up the webpage.  Is there a way to get the HTTP_REFERER code?
Or a different Javascript code?  I mean there's no way to get the PHP
execution to pause while the non-PHP programming get done first.  Is there?

Thanks,
 Scott



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

This message is intended for the sole use of the individual and entity to
whom it is addressed, and may contain information that is privileged,
confidential and exempt from disclosure under applicable law.  If you are
not the intended addressee, nor authorized to receive for the intended
addressee, you are hereby notified that you may not use, copy, disclose or
distribute to anyone the message or any information contained in the
message.  If you have received this message in error, please immediately
advise the sender by reply email and delete the message.  Thank you very
much.   

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




Re: [PHP] MySQL selecting the maximum value from a column

2002-02-05 Thread Lars Torben Wilson

On Tue, 2002-02-05 at 15:12, Melanie Gann wrote:
 Thank you all you listeners out there. I'll try to be respectful of your
 time and patience, and apoligize in advance for my greeness - I am 2
 weeks into PHP/MySQL.
 
 I am trying to select the higest value from the column Thought_Num below.
 But it returns nothing. 
 
 ?PHP
 $db = mysql_connect(localhost, root);
 mysql_select_db(DynaSite,$db);
 $result = mysql_query(SELECT MAX(Thought_Num) FROM quotes,$db);
 $myrow = mysql_fetch_array($result);
 print the result is $myrow[Thought_Num];
 ?
 
 If I change my select to something that without the MAX (e.g. Select from
 quotes where DocID=1), the code works fine. 
 
 Thanks in advance for your help.

Essentially, your problem here is that your query 'SELECT
MAX(Thought_Num) FROM quotes' will return a column named
'MAX(Though_Num)'--so you either need to do this:

   print the result is $myrow[MAX(Thought_Num)];

Or, much preferably, explicitly name the column in the query:

   SELECT max(Thought_Num) as Thought_Num FROM QUOTES

...and then access it as you had before.
 
 Regards,
 Melanie


Hope this helps,

Torben


-- 
 Torben Wilson [EMAIL PROTECTED]
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


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




[PHP] How do I keep form inputs from being cleared - Please Help!

2002-02-05 Thread SpamSucks86

I have a registration form and if a user enters bad information and the
php script generates an error, I want the user to be able to hit back
and have his inputs still there. Most websites I've ever used do this,
but for some reason, my form loses all its data when the back button is
pushed. This doesn't seem like something unique to PHP, but I thought
maybe you guys could shed some light. Maybe a header which instructs the
browser to cache it? Btw, I plan on having the script reprint the form
with the old values anyway, but for reference I'd really like to know
because I haven't been able to figure it out. Thanks for any help! =)
 
-Me



Re: [PHP] Problem...header already sent by

2002-02-05 Thread Ryan F. Bayhonan

Hello again Peter,

I describe my reply below.

 I must run it as Apache module.  Can someone tell me how do I change
 the setting to run as an APACHE module instead?

I'll be replying to this question in a Windows Operating System setting. You
have 2 option in installing PHP as in Win OS, either to use the executable
installer less than 1MB file size or to use the zip file almost 4MB file
size (I recommend to use the zip file installer since its more complete
interms of modules and othre dlls).

Unzipped the zip file into any directory you want then just read and follow
the instruction found on the install.txt file. The install.txt file also
indicated how to install PHP as a module on Apache, a minor changes on the
httpd.conf must be made. The install.txt file will tell you how.

Until then

Regards,

Ryan F. Bayhonan


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




Re: [PHP] date(), time() different to system time

2002-02-05 Thread DL Neil

Hey Anth,

 Hey guys,

=some of the better-looking amongst us are not guys (and then some of us are...)

 I'm running a RH7.2 box with apache 1.3.20 installed and php-4.1.1
 installed as a DSO.

 Everything is working fine, except that the output from any date() or
 time() references is 16 hours behind the system time (and hwtime) on the
 machine.

 The machine gets its time from an ntp server which is correct; this setup
 is similar for other boxes on the network which have no problems with the
 date or time in php being correct.

 If I output date('T') then the correct timezone (EST...I'm in Aus) is
 displayed, but any time or dates are 16 hours behind.

 Where does php read the time/date values from? Is there something I can
 tweak or something that I should look at to correct this? I know I could
 kludge around it in users php code by tacking an extra 16 hours onto each
 value but obviously that's not a good solution for a box which will be
 used by others!

 Any thoughts / headsup would be appreciated.


Check out the meaning of EST.
Sixteen hours behind NSW, Australian time would make it New York time wouldn't it?

Rather than the three-character codes, check out the +or- settings in the date 
functions to check that you
and your server are in the same time zone.

=dn



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




Re: [PHP] How do I keep form inputs from being cleared - Please Help!

2002-02-05 Thread Miles Thompson


http://www.thickbook.com
choose  the tutorial for a form with custom error messages.

Miles Thompson

At 06:40 PM 2/5/2002 -0500, SpamSucks86 wrote:
I have a registration form and if a user enters bad information and the
php script generates an error, I want the user to be able to hit back
and have his inputs still there. Most websites I've ever used do this,
but for some reason, my form loses all its data when the back button is
pushed. This doesn't seem like something unique to PHP, but I thought
maybe you guys could shed some light. Maybe a header which instructs the
browser to cache it? Btw, I plan on having the script reprint the form
with the old values anyway, but for reference I'd really like to know
because I haven't been able to figure it out. Thanks for any help! =)

-Me


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




[PHP] safe mode/mkdir problem - HELP!

2002-02-05 Thread Roberto P.Martins Jr

Hello!

I'm trying to create a directory, let's say: /some/dir. My script
(create_dir.cgi) is located at the cgi-bin directory and begins with
#!/usr/bin/php. So it's like any other script, isn't it?

The problem is: running php in safe mode with the script permissions:

rwxr-xr-x   8   rootroot1234 Nov 14 12:28 create_dir.cgi

I got:
Warning:  MkDir failed (Permission denied) in
/var/www/cgi-bin/create_dir.cgi on line xxx

When executing the instruction: mkdir('/some/dir', 0755);

But /some permissions are:

drwxr-xr-x8 root root 4096 Nov 14 12:28 /some

Running in safe mode, I thought that I could use mkdir() to create it,
because the ownerships are the same! Am I wrong? Safe mode only give
access when the ownerships are the same.

When I change the ownership to /some
to the uid/gid apache is running (apache(48)/apache(48)), I get:

Warning:  SAFE MODE Restriction in effect.  The script whose uid is 0 is
not allowed to access /some/dir owned by uid 48 in
/var/www/cgi-bin/create_dir.cgi on line xxx

And another doubt is: running my script as a cgi, with the php binary
outside the webserver tree, it runs like any other script (as written in
the manual). I should be able to run it is setuid flags and get complete
access, but even in this case the uid/gid that my script runs is always
the webserver process uid/gid (apache/apache)

I'm running RedHat Linux 7.2 with apache 1.3.22 and php 4.0.6. The php
package includes the php apache module and the php binary.

Thanks in advance,
Roberto

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




[PHP] Dynamic Dropdown menu question.

2002-02-05 Thread Michael O'Neal

Hi.

I'm working on an edit page where the pull down menu is populated from a
database.  I can't figure out how to print selected when that particular
record is the one associated with the current ID.  Can anyone help?

Here's my current code:

!-- Dynamic Career Menu--

?php

include(common.inc);


$connection = @mysql_connect($db_host,$db_user,$db_pass) or
die(Couldn't Connect.);
$db = @mysql_select_db($db_name, $connection) or die(Couldn't select
database.);


$sql =SELECT job_id,category,description,job_id AS my_job_id FROM
$cat_table_name;
$result = @mysql_query($sql, $connection) or die(Error #. mysql_errno() .
:  . mysql_error());

while ($row = mysql_fetch_array($result)) {

$job_id=$row['job_id'];
$category=$row['category'];
$description=$row['description'];
$my_job_id=$row['my_job_id'];


echo option value=\$job_id\ ;

if ($job_id == '$my_job_id') {

echo  selected ;
} 

echo  $title/option;


}

$num = @mysql_num_rows($result);


?
!-- /Dynamic Career Menu--


This is about the 5th iteration of this menu I've been working on.  If
anyone has any ideas, please email me at [EMAIL PROTECTED] as I am on the
digest.

Thanks,

mto

-- 

Michael O'Neal
Web Producer
-
 M   A   N   G   O
B  O  U  L  D  E  R
-
http://www.thinkmango.com
e- [EMAIL PROTECTED]
p- 303.442.1821
f- 303.938.8507



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




Re: [PHP] Dynamic Dropdown menu question.

2002-02-05 Thread Lars Torben Wilson

On Tue, 2002-02-05 at 16:23, Michael O'Neal wrote:
 Hi.
 
 I'm working on an edit page where the pull down menu is populated from a
 database.  I can't figure out how to print selected when that particular
 record is the one associated with the current ID.  Can anyone help?
 
 Here's my current code:
 
 !-- Dynamic Career Menu--
 
 ?php
 
 include(common.inc);
 
 
 $connection = @mysql_connect($db_host,$db_user,$db_pass) or

This isn't your problem, but you do not really need to quote the above
variables.

 die(Couldn't Connect.);
 $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
 database.);
 
 
 $sql =SELECT job_id,category,description,job_id AS my_job_id FROM
 $cat_table_name;
 $result = @mysql_query($sql, $connection) or die(Error #. mysql_errno() .
 :  . mysql_error());
 
 while ($row = mysql_fetch_array($result)) {
 
 $job_id=$row['job_id'];
 $category=$row['category'];
 $description=$row['description'];
 $my_job_id=$row['my_job_id'];
 
 
 echo option value=\$job_id\ ;
 
 if ($job_id == '$my_job_id') {
 
 
This is your problem: remove the quotes. PHP does not interpolate 
single-quoted strings:

http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single

[snip]


Hope this helps,

Torben

 -- 
 
 Michael O'Neal
 Web Producer
-- 
 Torben Wilson [EMAIL PROTECTED]
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


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




Re: [PHP] Dynamic Dropdown menu question.

2002-02-05 Thread Jeff Sheltren

Hi, looking at your sql statement, it seems like you are always setting 
my_job_id and job_id to the same value for each row in the table.  select 
job_id AS my_job_id is just putting the value of job_id in a variable 
called my_job_id.  Could you tell us the structure of your mysql table please?

Jeff

At 05:23 PM 2/5/2002 -0700, Michael O'Neal wrote:
Hi.

I'm working on an edit page where the pull down menu is populated from a
database.  I can't figure out how to print selected when that particular
record is the one associated with the current ID.  Can anyone help?

Here's my current code:

!-- Dynamic Career Menu--

?php

include(common.inc);


$connection = @mysql_connect($db_host,$db_user,$db_pass) or
die(Couldn't Connect.);
$db = @mysql_select_db($db_name, $connection) or die(Couldn't select
database.);


$sql =SELECT job_id,category,description,job_id AS my_job_id FROM
$cat_table_name;
$result = @mysql_query($sql, $connection) or die(Error #. mysql_errno() .
:  . mysql_error());

while ($row = mysql_fetch_array($result)) {

$job_id=$row['job_id'];
$category=$row['category'];
$description=$row['description'];
$my_job_id=$row['my_job_id'];


echo option value=\$job_id\ ;

 if ($job_id == '$my_job_id') {

 echo  selected ;
 }

echo  $title/option;


}

$num = @mysql_num_rows($result);


?
!-- /Dynamic Career Menu--


This is about the 5th iteration of this menu I've been working on.  If
anyone has any ideas, please email me at [EMAIL PROTECTED] as I am on the
digest.

Thanks,

mto

--

Michael O'Neal
Web Producer
-
  M   A   N   G   O
B  O  U  L  D  E  R
-
http://www.thinkmango.com
e- [EMAIL PROTECTED]
p- 303.442.1821
f- 303.938.8507



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



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




  1   2   >