[PHP] passed val compare to array val

2002-04-12 Thread sundogcurt

Hi guys, like every other problem I have this one is SURE to be 
painfully simple to fix and make me look g0ofy again.

I have an edit user form with checkboxes like the one below :

INPUT type=checkbox value=Boating name=Activity[] 
?docheck(Boating)?

When the form loads I grab the users relevant information and display 
it, I am having trouble checking checkboxes that should be checked 
though. Here is how I am attempting to do it.

Prior to the form loading I load an array with the required checkbox 
VALUES, not names, I did it this way because I reference the checkbox 
values as an array to write to a database.

As the form loads I call a function docheck() and pass $inputvalue 
(the value of the checkbox) compare the values pulled from the database 
and if there is a match, I write CHECKED to indicate that the user had 
previously chosen this.

The function is below :

function docheck($inputvalue){
$flag = 0;
$tempcnt = 0;
$temptotal = count($editActivity);
while($tempcnt != $temptotal){
if($inputvalue == $editActivity[$tempcnt]){
$flag = 1;
}
$tempcnt++;
}
if($flag == 1){
print CHECKED;
}
}

The problem seems to be that a match never occurs, I tried passing 
Boating and re-wrote the function as such...

$flag = 0;
if($inputvalue == 'Boating'){
$flag = 1;
}
if($flag == 1){
print CHECKED;
}


and it worked just fine, so I am of a mind that I am doing something 
wrong while attempting to match my passed value with the values in my 
array.

Please help!

-- 
Curtis Gordon
Groovy Web Developer
 168th Street
White Rock


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




[PHP] passing array from one page to itself?

2002-04-12 Thread sundogcurt

Hi again guys, I'm having trouble finding documentation on passing an 
array. Here is what I am doing.

I have one page that calls itself, I want to pass an array that is setup 
the first time it's called to itself the second time it's called.
I'm running out of both time AND hair (both of which are a rare comodoty 
these days).

Any hint will be a HUGE help!

Thanks in advance.


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




Re: [PHP] passing array from one page to itself?

2002-04-12 Thread sundogcurt

You didn't by any chance go by the name 99ways2die at one time did you?

I thought of that but when the second page loads the values are dumped 
into a db and I have it written already and it uses an array, I would 
like to keep it that way

(Gru)

[EMAIL PROTECTED] wrote:

You could do something like the following:

$array = array(value1,value2,value3);
for($i=0;$icount($array);$i++){
echo input type=hidden name=\value$i\ value=\$array[$i]\;
}
--

On Fri, 12 Apr 2002 17:14:14  
 sundogcurt wrote:

Hi again guys, I'm having trouble finding documentation on passing an 
array. Here is what I am doing.

I have one page that calls itself, I want to pass an array that is setup 
the first time it's called to itself the second time it's called.
I'm running out of both time AND hair (both of which are a rare comodoty 
these days).

Any hint will be a HUGE help!

Thanks in advance.


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




See Dave Matthews Band live or win a signed guitar
http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp
 





[PHP] loading Arrays

2002-02-28 Thread sundogcurt

Do I have to fully load up an array when I declare it or can I assign 
more values to it later?
What I want to do is something like this :

// create empty array
$samplearray = array();

// add value to array
if($flag == true){
$samplearray = $samplevalue;
}

This doesn't work, can anybody tell me if I'm on the right track here or 
should I scrap it and start over?

Thanks
Curt


-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




Re: [PHP] PHP and listbox multiple selections

2002-01-31 Thread sundogcurt

form name= action= method=

Notice the [ ] at the end of the select box name, this prompts php to 
treat the values as an array.

select name=options[] size=10 multiple
?
$query = select value1,value2 from table;
if($result=mysql_query($query)){
while ($myrow = mysql_fetch_row($result)) {
print option value='$myrow[0]'$myrow[1];
}
}
?
/select
input type=submit value=submit
/form


When the form is submitted I fire this code

$mycount = count($options); // get the number of elements in the 
array (selected in the drop down)
while($mycount){// cycle through the array decrementling your 
counter var ($mycount) untill you have inserted all of the values.
$mycount--;
mysql_query(INSERT INTO table (value1,value2) VALUES 
($value1,$options[$mycount]));
}


I hope this helps, it works perfectly for me and uses less code than 
other examples I have seen.


 On Monday, January 28, 2002, at 10:41  AM, Simos Varelakis wrote:

 A php form  contains a listbox  (named foolist) with n Items which 
 can be
 multiple selected and form posted to
 results.php how can results.php determine which items were selected 
 in order
 to add all the items in a Mysql table ???




-- 
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] funny unlink problem

2002-01-30 Thread sundogcurt

unlink(); help

the file I would like to delete (actual path)
/home/gruesome/public_html/nuved/clients/prestigemotors/images/55jpg

path I am feeding to unlink function
/home/gruesome/public_html/nuved/clients/prestigemotors/images/55jpg

error I get when I try to delete the file
Warning: Unlink failed (No such file or directory) in 
/home/gruesome/public_html/nuved/includes/content/addvehicle.php on line 
315

relative path to file (from script containing the unlink function)
../../clients/prestigemotors/images/55jpg

I am copying the file with the same script ($folder = 'prestigemotors' 
 $tempVID = '55')
$destination = '/home/gruesome/public_html/nuved/clients/' . $folder . 
'/images/' . $tempVID . '.jpg';
if(copy(stripslashes($ipath),$destination)) ...

Mandrake / Apache / Frustration

help?


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




Re: [PHP] funny unlink problem

2002-01-30 Thread sundogcurt

AARHHH!!!

thank you!
(man I hate that...)

[EMAIL PROTECTED] wrote:

I see 55jpg NOT 55.jpg

--Tony

On Wed, 2002-01-30 at 12:40, sundogcurt wrote:

unlink(); help

the file I would like to delete (actual path)
/home/gruesome/public_html/nuved/clients/prestigemotors/images/55jpg

path I am feeding to unlink function
/home/gruesome/public_html/nuved/clients/prestigemotors/images/55jpg

error I get when I try to delete the file
Warning: Unlink failed (No such file or directory) in 
/home/gruesome/public_html/nuved/includes/content/addvehicle.php on line 
315

relative path to file (from script containing the unlink function)
../../clients/prestigemotors/images/55jpg

I am copying the file with the same script ($folder = 'prestigemotors' 
 $tempVID = '55')
$destination = '/home/gruesome/public_html/nuved/clients/' . $folder . 
'/images/' . $tempVID . '.jpg';
if(copy(stripslashes($ipath),$destination)) ...

Mandrake / Apache / Frustration

help?


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




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




Re: [PHP]Upload file to system

2002-01-28 Thread sundogcurt

Is that a bad word?

\ :

[EMAIL PROTECTED] wrote:

Did someone say hosting fees?

- Original Message -
From: sundogcurt [EMAIL PROTECTED]
To: GENERAL PHP LIST [EMAIL PROTECTED]
Sent: Monday, January 28, 2002 3:32 PM
Subject: Re: [PHP]Upload file to system


You could try contacting your server admin and seeing if he / she will
increase the limit...

That would be where I would start.
If  that doesn't work, my hosting fees are quite reasonable  ahah



[EMAIL PROTECTED] wrote:

Thnx. it's working now. But.. Howcome I can only upload files no bigger
then 100 kb? I have changed the MAX_FILE_SIZE to 10. Also, I

can't

change the php.ini, coz the webserver isn't mine.. what to do now??

Sundogcurt wrote:

http://www.php.net/manual/en/features.file-upload.php
http://www.faqts.com/knowledge_base/view.phtml/aid/988

: )

[EMAIL PROTECTED] wrote:

I want to make something like when you are attaching something to an
email in hotmail. I want to make something that searches your own
computer for files on your harddisk that you want to upload to the
server.

But I don't know if this is possible. If this is possible.Can somebody
tell me which function I should use? Or if someone have an example...
please...

Duky











Re: [PHP] Date function

2002-01-28 Thread sundogcurt

Is this date stored in mysql by anychance?

[EMAIL PROTECTED] wrote:

Hi All,

Is there any function in PHP4.X or in Oracle8i to calculate number of
Business days ( excluding Saturday and Sunday)  between two given dates?

Thanks in advance.
Sridhar.

-Original Message-
From: qartis [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 28, 2002 1:38 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] Re: [PHP] File uploading like hotmail


I think you might be looking for input type=file HTML form element.


Duky Yuen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

I want to make something like when you are attaching something to an
email in hotmail. I want to make something that searches your own
computer for files on your harddisk that you want to upload to the
server.

But I don't know if this is possible. If this is possible.Can somebody
tell me which function I should use? Or if someone have an example...
please...

Duky




--
PHP Database 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] upload permission denied!

2002-01-28 Thread sundogcurt

I'm not sure if this is a problem I can overcome with PHP or if I have 
to go directly to the Linux box to fix (I hope not).

I have moved my development from a win32/apache/mysql box to a 
Mandrake/apache/mysqly box and have only one problem (that I know of) to 
overcome.

When I try to upload an image (with scripts that worked just fine on the 
win32 system) I get a permission denied error. The dir that I am trying 
to write to has permissions for everybody to do anything! (777 or 0777 
how ever you want to format it). The scripts are located in my user dir 
under public_html etc etc. I can create directories in there but I can't 
seem to convince the darn thing to copy an image. It seems to upload (no 
errors) but that is where it ends. I don't know what other information 
you need from me or if this is even the proper list to be submitting to.

Again I say I am able to create directories but not copy an image. ???

Thanks and I'm sorry that my question has anything to do with uploading 
stuff eheheh

~Curtis~


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




Re: [PHP] upload permission denied!

2002-01-28 Thread sundogcurt

Like so?

error message :
Warning: Unable to create 'sdf.jpg': Permission denied in 
/home/gruesome/public_html/valeriemacwilliam/includes/content/addpic.php 
on line 21

code :
?
if($myfile){
if(copy(stripslashes($myfile), $newname . '.jpg')){
print pdone/p;
}else{
print pnot done/p;
}
}
?
h2 align=centerAdd Picture/h2
form action=?print $PHP_SELF? method=post 
enctype=multipart/form-data name=addpicform
input type=hidden name=action value=addpic
input type=hidden name=status value=0
input type=hidden name=sorder value=0
new file name input type=text name=newnamebr /
input type=hidden name=MAX_FILE_SIZE value=100
input name=myfile type=filebr /
input type=submit value=Send file
/form






[EMAIL PROTECTED] wrote:


At least give us the error you get.

And it sounds like I'd need to see your code too.

bvr.

On Mon, 28 Jan 2002 15:23:50 -0800, sundogcurt wrote:

I'm not sure if this is a problem I can overcome with PHP or if I have 
to go directly to the Linux box to fix (I hope not).

I have moved my development from a win32/apache/mysql box to a 
Mandrake/apache/mysqly box and have only one problem (that I know of) to 
overcome.

When I try to upload an image (with scripts that worked just fine on the 
win32 system) I get a permission denied error. The dir that I am trying 
to write to has permissions for everybody to do anything! (777 or 0777 
how ever you want to format it). The scripts are located in my user dir 
under public_html etc etc. I can create directories in there but I can't 
seem to convince the darn thing to copy an image. It seems to upload (no 
errors) but that is where it ends. I don't know what other information 
you need from me or if this is even the proper list to be submitting to.

Again I say I am able to create directories but not copy an image. ???

Thanks and I'm sorry that my question has anything to do with uploading 
stuff eheheh








Re: [PHP] upload permission denied!

2002-01-28 Thread sundogcurt

the directory permissions are set to 777 / 0777 any user, any group, 
etc. at least that is how I understand it. if i'm wrong please correct 
me, I do appreciate the help thank you.

[EMAIL PROTECTED] wrote:

On Tuesday 29 January 2002 11:10, sundogcurt wrote:

Like so?

error message :
Warning: Unable to create 'sdf.jpg': Permission denied in
/home/gruesome/public_html/valeriemacwilliam/includes/content/addpic.php
on line 21

code :
?
if($myfile){
if(copy(stripslashes($myfile), $newname . '.jpg')){
print pdone/p;
}else{
print pnot done/p;
}
}



[snip]


You need to change to the permissions of the directory in which you want to 
copy the file to, so that it's writable by the 'user' running the webserver.






Re: [PHP] upload permission denied!

2002-01-28 Thread sundogcurt

That is where the script is that uploads the file, the file should be 
going to  :

/home/gruesome/public_html/valeriemacwilliam/includes/content/

/home/gruesome/public_html/valeriemacwilliam/pics/
or /tmp/ or where ever I have tried a ton of different folders

[EMAIL PROTECTED] wrote:

On Tuesday 29 January 2002 11:48, sundogcurt wrote:

the directory permissions are set to 777 / 0777 any user, any group,
etc. at least that is how I understand it. if i'm wrong please correct
me, I do appreciate the help thank you.


If they're set to 777 then anybody can do anything to it which means it 
should be OK. The only thing is whether you have set the *correct* directory? 
According to your code, I believe the file will be copied to:

  /home/gruesome/public_html/valeriemacwilliam/includes/content/
  
Is this correct?






Re: [PHP]Upload file to system

2002-01-27 Thread sundogcurt

http://www.php.net/manual/en/features.file-upload.php
http://www.faqts.com/knowledge_base/view.phtml/aid/988

: )

[EMAIL PROTECTED] wrote:

I want to make something like when you are attaching something to an
email in hotmail. I want to make something that searches your own
computer for files on your harddisk that you want to upload to the
server.

But I don't know if this is possible. If this is possible.Can somebody
tell me which function I should use? Or if someone have an example...
please...

Duky





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




Re: [PHP]Upload file to system

2002-01-27 Thread sundogcurt

You could try contacting your server admin and seeing if he / she will 
increase the limit...

That would be where I would start.
If  that doesn't work, my hosting fees are quite reasonable  ahah



[EMAIL PROTECTED] wrote:

Thnx. it's working now. But.. Howcome I can only upload files no bigger
then 100 kb? I have changed the MAX_FILE_SIZE to 10. Also, I can't
change the php.ini, coz the webserver isn't mine.. what to do now??

Sundogcurt wrote:

http://www.php.net/manual/en/features.file-upload.php
http://www.faqts.com/knowledge_base/view.phtml/aid/988

: )

[EMAIL PROTECTED] wrote:

I want to make something like when you are attaching something to an
email in hotmail. I want to make something that searches your own
computer for files on your harddisk that you want to upload to the
server.

But I don't know if this is possible. If this is possible.Can somebody
tell me which function I should use? Or if someone have an example...
please...

Duky








[PHP] ftp functions

2002-01-21 Thread sundogcurt

disclamer
Before I get flamed for not reading the manual or trying on my own, I 
would just like to say that I have been working on this for a few days 
and have read the manual and looked at quite a few examples, all of 
which seem to elude me.
/disclamer

I want to upload an image, and I want to use the ftp function to do so. 
I want to use the ftp functions for two reasons, (1) I have not used 
them yet, and (2) I will be loading an array with a list of files to be 
uploaded and I think the ftp functions are better suited for this (as 
opposed to the copy function).

On to the trouble

I can connect just fine.

?
$ftp_server = xx.xx.xxx.xx;
$ftp_user_name = username;
$ftp_user_pass = password;

// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// check connection
if ((!$conn_id) || (!$login_result)) {
echo Ftp connection has failed!br;
echo Attempted to connect to $ftp_server for user 
$ftp_user_namebr;
die;
} else {
echo Connected to $ftp_server, for user $ftp_user_namebr;
}


//The file, even if I write the path out on my own, does not upload 
eventually I will have the path put in from a form.


// upload the file
$destination_file = /public_html/valeriemacwilliam/pics/$SID_.jpg;
//(I have tried this without the beginning slash as well)

$source_file = C:\\temp\\prestigecars\\bk_jag.jpg;

$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);

// check upload status
if (!$upload) {
echo Ftp upload has failed!br;
} else {
echo Uploaded $source_file to $ftp_server as 
$destination_filebr;
}

//Even the ftp_close(function fails and causes an error);
// close the FTP stream
ftp_close($conn_id);
?

Are the ftp functions depreciated? I have taken this example directly 
from the manual and editted the values to reflect my own situation but 
none of the function calls have been editted. Usually when this is the 
case I have just over looked something VERY simple and easy, please take 
a look and see what you can come up with.

I would even be happy with an FAQ, I have been through the one on 
PHP.NET with no joy   \C:

PHP is the lastest release running on Mandrake 8.1 (w / plenty of 
horsepower)

Thank you for your time.
~Curt~


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




Re: [PHP] ftp functions

2002-01-21 Thread sundogcurt

Would you suggest that I use the copy function instead?
I have tried the copy function in a prelim test and I had trouble with 
the function finding the file on the local machine. From what I have 
seen in the FAQs on PHPBUILDER and this is not an uncommon problem.

One possible solution was that the path to the file to be uploaded must 
be relative to the location of the script. This doesn't make much sense 
to me though seeing as the file to be uploaded is on the local machine 
and the script on the remote machine.

I'm drowning here, anybody have a rope?


[EMAIL PROTECTED] wrote:

one problem, the ftp functions that you are trying to use are on the server.
therefor you are trying to connect one server to another server.  you
are not connecting from your workstation to the remote server.  for what you
are attempting to do, ftp will not work.

Jim Lucas
- Original Message -
From: sundogcurt [EMAIL PROTECTED]
To: GENERAL PHP LIST [EMAIL PROTECTED]
Sent: Monday, January 21, 2002 10:47 AM
Subject: [PHP] ftp functions


disclamer
Before I get flamed for not reading the manual or trying on my own, I
would just like to say that I have been working on this for a few days
and have read the manual and looked at quite a few examples, all of
which seem to elude me.
/disclamer

I want to upload an image, and I want to use the ftp function to do so.
I want to use the ftp functions for two reasons, (1) I have not used
them yet, and (2) I will be loading an array with a list of files to be
uploaded and I think the ftp functions are better suited for this (as
opposed to the copy function).

On to the trouble

I can connect just fine.

?
$ftp_server = xx.xx.xxx.xx;
$ftp_user_name = username;
$ftp_user_pass = password;

// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// check connection
if ((!$conn_id) || (!$login_result)) {
echo Ftp connection has failed!br;
echo Attempted to connect to $ftp_server for user
$ftp_user_namebr;
die;
} else {
echo Connected to $ftp_server, for user $ftp_user_namebr;
}


//The file, even if I write the path out on my own, does not upload
eventually I will have the path put in from a form.


// upload the file
$destination_file = /public_html/valeriemacwilliam/pics/$SID_.jpg;
//(I have tried this without the beginning slash as well)

$source_file = C:\\temp\\prestigecars\\bk_jag.jpg;

$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);

// check upload status
if (!$upload) {
echo Ftp upload has failed!br;
} else {
echo Uploaded $source_file to $ftp_server as
$destination_filebr;
}

//Even the ftp_close(function fails and causes an error);
// close the FTP stream
ftp_close($conn_id);
?

Are the ftp functions depreciated? I have taken this example directly
from the manual and editted the values to reflect my own situation but
none of the function calls have been editted. Usually when this is the
case I have just over looked something VERY simple and easy, please take
a look and see what you can come up with.

I would even be happy with an FAQ, I have been through the one on
PHP.NET with no joy   \C:

PHP is the lastest release running on Mandrake 8.1 (w / plenty of
horsepower)

Thank you for your time.
~Curt~


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








Re: [PHP] RTFM

2002-01-19 Thread sundogcurt

I've been (sorta) following this thread for the last little while and I 
have to say that I'm on the side of one list for all!. The problem 
with splitting the list is the different levels of newbie-ism on 
different subjects, There are things that advanced users can learn from 
new comers to the language too.

For instance. I don't really consider myself a total newb when it 
comes to PHP anymore, but there are areas of the language that I still 
haven't touched upon, which would make me a newbie. I agree though that 
some questions are asked a little too often, and that could be due to 
unclear documentation. If it is bothersome to you, write a nice simple 
tutorial and post it!

For example, quite often I see people ask how to INSERT multiple values 
from one selectbox. I have yet to see anybody post any help save for 
telling people to use checkboxes instead. Using a selectbox for this 
isn't all that difficult at all!

mini tutorial
//FIRST YOU START WITH A SELECTBOX
select name=selectpackage[] multiple

//NOTE THE [] AT THE END OF THE NAME FOR THE SELECTBOX, ONCE SUBMITTED 
THIS WILL BE TREATED AS AN ARRAY CONTAINING THE SELECTED VALUES.

//THE MULTIPLE STATEMENT ALLOWS THE USER TO SELECT MULTIPLE OPTIONS 
INSTEAD OF JUST ONE.

option value=00/option
option value=11/option
option value=22/option
/select

/// AFTER THE FORM IS SUBMITTED ///

//GET A COUNT ON THE NUMBER OF ENTRIES SELECTED
$mycount = count($selectpackage);

//USE THE RESULT FOR A COUNTER
while($mycount){
$mycount--;

//RUN YOUR INSERT COMMAND UNTIL THE COUNTER HAS EXPIRED
mysql_query(INSERT INTO mytable (myvalue1,myvalue2) VALUES 
('$selectpackage[$mycount]', '$mycount'));
}

/mini tutorial

Maybe some of use should get together and start putting things like this 
in a repository with an easy flexible search. I know from experience 
that some of the documentation that is available to new users is a bit 
on the stuffy side. Sometimes a better approach is to give up some 
starter code and let them go from there.

Just my two cents worth and a mini tutorial that can be used to get 
things started.

Now if you'll excuse me, I have to continue banging my forehead on my 
keyboard figuring out this %$#%$#@ file upload. (C:

We all benefit from new and used users alike.
~Curt~


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




Re: [PHP] RTFM

2002-01-19 Thread sundogcurt

I would be more than happy to put some mini-tutorials together to send 
you, I'm not sure of the relevance of them though. Maybe adding a 
suggest a tut area where people that are having trouble can request a 
tutorial and anybody interested can fire one in?

Just a thought
~Curt~

[EMAIL PROTECTED] wrote:

I've actually been working on just that.  I've been reading this list for a
long time and noticed the repetition.  I have 65+ faqs on my site
http://www.php-faq.com/  that are there basically from my own experiences.
I haven't posted it yet, because I don't think it's full enough.  It even
has a suggest-a-faq page, that'd I'd need to activate. I do like your idea
of mini-tutorials.  I have a lot of programming experience (12+ years),
mostly in business applications, and know what it's like to struggle.  The
mailing list is awesome; I've never really posted a question because the
answers are in the archive.

- Original Message -
From: sundogcurt [EMAIL PROTECTED]
To: GENERAL PHP LIST [EMAIL PROTECTED]
Sent: Saturday, January 19, 2002 12:56 PM
Subject: Re: [PHP] RTFM


I've been (sorta) following this thread for the last little while and I
have to say that I'm on the side of one list for all!. The problem
with splitting the list is the different levels of newbie-ism on
different subjects, There are things that advanced users can learn from
new comers to the language too.

For instance. I don't really consider myself a total newb when it
comes to PHP anymore, but there are areas of the language that I still
haven't touched upon, which would make me a newbie. I agree though that
some questions are asked a little too often, and that could be due to
unclear documentation. If it is bothersome to you, write a nice simple
tutorial and post it!

For example, quite often I see people ask how to INSERT multiple values
from one selectbox. I have yet to see anybody post any help save for
telling people to use checkboxes instead. Using a selectbox for this
isn't all that difficult at all!

mini tutorial
file://FIRST YOU START WITH A SELECTBOX
select name=selectpackage[] multiple

file://NOTE THE [] AT THE END OF THE NAME FOR THE SELECTBOX, ONCE

SUBMITTED

THIS WILL BE TREATED AS AN ARRAY CONTAINING THE SELECTED VALUES.

file://THE MULTIPLE STATEMENT ALLOWS THE USER TO SELECT MULTIPLE OPTIONS
INSTEAD OF JUST ONE.

option value=00/option
option value=11/option
option value=22/option
/select

/// AFTER THE FORM IS SUBMITTED ///

file://GET A COUNT ON THE NUMBER OF ENTRIES SELECTED
$mycount = count($selectpackage);

file://USE THE RESULT FOR A COUNTER
while($mycount){
$mycount--;

file://RUN YOUR INSERT COMMAND UNTIL THE COUNTER HAS EXPIRED
mysql_query(INSERT INTO mytable (myvalue1,myvalue2) VALUES
('$selectpackage[$mycount]', '$mycount'));
}

/mini tutorial

Maybe some of use should get together and start putting things like this
in a repository with an easy flexible search. I know from experience
that some of the documentation that is available to new users is a bit
on the stuffy side. Sometimes a better approach is to give up some
starter code and let them go from there.

Just my two cents worth and a mini tutorial that can be used to get
things started.

Now if you'll excuse me, I have to continue banging my forehead on my
keyboard figuring out this %$#%$#@ file upload. (C:

We all benefit from new and used users alike.
~Curt~


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







Re: [PHP] PHP as a cron job

2002-01-16 Thread sundogcurt

I know this is a total hack job but  could you say, set the location 
of the script as your default page in a browser, then open the browser 
via cron and it would run it as the page opens?

I am interested in this too, I am VERY new to Linux and have only just 
started to look at cron, any links to SIMPLE tutorials or something 
similar would be appreciated.


[EMAIL PROTECTED] wrote:

on 1/16/02 11:26 AM, Tiago Luchini at [EMAIL PROTECTED] wrote:

Unable to open /home/admin/webmin-0.85/ in Unknown on line 0

this is possibly a path or env issue. have you tried using absolute
filenames?

Yes. Same thing happens with absolute or relative paths.

what's the line in your code where this error occurs?

it doesn't run any line at all. don't matter what I put on my code, it just
says unable to open



what's the first line of the file being called by cron? is it

  #!/usr/local/bin/php -q



 -- mike cullerton   michaelc at cullerton dot com







Re: [PHP] mysql_fetch_row win32 to Linux

2002-01-13 Thread sundogcurt

Like this

$myquery = SELECT * FROM xpackage;
print pmyquery = $myquery/p;
$myresult = mysql_query($myquery);
while($myrowz = mysql_fetch_row($myresult)){
   print p . $myrowz[0] . /p;
}

[EMAIL PROTECTED] wrote:

on 1/12/02 11:45 AM, sundogcurt at [EMAIL PROTECTED] wrote:

myquery = SELECT * FROM xpackage
Warning: Supplied argument is not a valid MySQL result resource in /path
to page with error/default.php on line 5

Line 5 is this part
while($myrowz = mysql_fetch_row($myresult)){


this tells me that $myresult is not a valid mysql result resource
identifier. how do you obtain $myresult?


 -- mike cullerton 







[PHP] SELECT DAYOFYEAR(NOW())

2002-01-13 Thread sundogcurt

Hi! I'm storing a date in this format :

2002-01-13 11:08:40
-mm-dd hh:mm:ss

This is great because it gives me the date and the time, which I need.
I want to compare this date from the database to the current DAYOFYEAR()

but when I do this
select DAYOFYEAR('2002-01-13 11:08:40')

I get this


  Error - Perl execution failed

Modification of non-creatable array value attempted, subscript -1 at ./mysql-lib.pl 
line 187,  line 2.



It works great when I do select DAYOFYEAR(NOW()) though, I'm totally 
confused, is this a known bug or is there a work around that anybody 
knows of that you can let me in on?

Ulitmately I want to compare todays DAYOFYEAR to the DAYOFYEAR from 
fields in the database to establish entries that were created today.

I'm looking at what I have written here and I think I have confused 
myself, if this is not clear, please feel free to flame me.

I'm looking forward to any light that can be shed on this problem.

















Re: [PHP] SELECT DAYOFYEAR(NOW())

2002-01-13 Thread sundogcurt

I am a dork!
And you answered that almost before I sent it, you're like Mighty Mouse 
on Ginseng!

[EMAIL PROTECTED] wrote:

This doesn't appear to be a PHP question.  Are you sure you are on the
right list?

On Sun, 13 Jan 2002, sundogcurt wrote:

Hi! I'm storing a date in this format :

2002-01-13 11:08:40
-mm-dd hh:mm:ss

This is great because it gives me the date and the time, which I need.
I want to compare this date from the database to the current DAYOFYEAR()

but when I do this
select DAYOFYEAR('2002-01-13 11:08:40')

I get this


  Error - Perl execution failed

Modification of non-creatable array value attempted, subscript -1 at ./mysql-lib.pl 
line 187,  line 2.



It works great when I do select DAYOFYEAR(NOW()) though, I'm totally
confused, is this a known bug or is there a work around that anybody
knows of that you can let me in on?

Ulitmately I want to compare todays DAYOFYEAR to the DAYOFYEAR from
fields in the database to establish entries that were created today.

I'm looking at what I have written here and I think I have confused
myself, if this is not clear, please feel free to flame me.

I'm looking forward to any light that can be shed on this problem.




















[PHP] mysql_fetch_row win32 to Linux

2002-01-12 Thread sundogcurt

Hi everybody, I have some scripts running on win32 Apache mySQL and they 
all run great. I have copied the entire application to my Linux box 
which I think I have running pretty smoothly now. The database is there 
and I can access it just fine etc etc.

Here is the hitch (there's always a hitch) I can't get PHP to retrieve 
my data after a SELECT query. I know the query works simply by setting 
and displaying flags. It seems to choke on mysql_fetch_row. Here is an 
example.

Here is a snippet I have written

$myquery = SELECT * FROM xpackage;
print pmyquery = $myquery/p;
$myresult = mysql_query($myquery);
while($myrowz = mysql_fetch_row($myresult)){
print p . $myrowz[0] . /p;
}

On the  win32 box (identical snippet and identical db on both machines) 
I get this back

myquery = SELECT * FROM xpackage
62
61
60
59
58
57
56
55
54
53
115
114
127
126
111
125

On the Linux box I get this

myquery = SELECT * FROM xpackage
Warning: Supplied argument is not a valid MySQL result resource in /path 
to page with error/default.php on line 5

Line 5 is this part
while($myrowz = mysql_fetch_row($myresult)){

I am at a total loss, I have not seen anywhere stating that 
mysql_fetch_row is depreciated, does anybody have anything to add to 
this to help me out?


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




Re: [PHP] help with include

2002-01-12 Thread sundogcurt

I think you can use a URL when you specify your value in the include 
statement, can you not?

[EMAIL PROTECTED] wrote:

Hi, I need some help with the include function.
I have a phpBB script and want to put the config.inc.php file in a password
protected directory, Easy peasy you might say, and I know it is, but the
problem comes because the password protected directory isn't on the site the
script is on, mainly because the host says I've got to upgrade my account to
use password protected dir's.
I've got one site with a password protected dir available and would like to
put it on there.

Any idea's how to do it would be appreciated.

Many thanks

Brian






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




Re: [PHP] Using a HTML button

2002-01-11 Thread sundogcurt


JAVASCRIPT VERSION
html
head
titlemytitle/title
script language=JavaScript type=text/javascript
function multiply(x){
var myresult = 2 * x;
document.write(myresult);
}
/script
/head
body
form name=myform action=?$PHP_SELF? method=POST
input type=button name=mybutton value=myvalue 
onClick=multiply(5)
/form
/body
/html



PHP VERSION
html
head
titlemytitle/title
/head
body
if($mybutton){
$myresult = 2 * $mybutton;
print $myresult;
}else{
print Click the button to see what 2 mulitplied by 5 is!;
}
form name=myform action=?$PHP_SELF? method=POST
input type=button name=mybutton value=5 onClick=mysubmit()
/form
/body
/html


You can do it either way, don't take my code at face value (sorry, 
couldn't resist) I haven't tested it, but it should be enough to get you 
going. I would suggest that you use the PHP version, that way you don't 
have to worry about cross browser JavaScript compatibility.

  Hi,
 
  I am rather new to PHP so I hope somebody can help me.
 
  I have a normal button (HTML code). Then I have made a function
 
  function multiply($X)
  {
  return 2*$X;
  }
 
  The button has an OnClick, which calls my function.
  INPUT TYPE=BUTTON name=HH value=Mul onClick=? 
 $XX=multiply(5);? 
 
  I then writes $X to the screen.
 
  ?php echo $X ?
 
  The problem is I dont even have to press the button. When the page 
 loads it
  already has calculated 2*$X. Why is that. I would like to only call my
  function when I press my button.

 What value is it returning 5, or 10?

 Nick Wilson

 Tel:+45 3325 0688
 Fax:+45 3325 0677
 Web:www.explodingnet.com






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




Re: [PHP] Select box won't display in Netscape 4.xx

2001-12-31 Thread sundogcurt

Have you double and triple checked to be sure your form elements are 
nested properly?

[EMAIL PROTECTED] wrote:

Hi,

I'm developing a website for multiple browsers. In Netscape 4.xx (both
Win98 and Linux versions), the php-scripts display the select boxes in
my forms only as plain text. I cannot make any selections. In other
browsers (NS 6 and IE5), it works fine.

Anyone seen this behavior before?

Regards,
Edwin





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




Re: [PHP] take date and convert to day of year fixed!

2001-11-14 Thread sundogcurt

OK GOT IT!!

$utine = strtotime(26-Nov-2001);
$bday=(int)$utine;

$utoday = strtotime();
$btoday = (int)$utoday;

if((($bday-$btoday) = 1209600  ($bday-$btoday)0)){
print you have  . round(($bday-$btoday)/86400). Days till 
'blanks' bdaybr;
print you are within the two week range.;
}else{
print you are NOT within the date range.;
}

It's messy but it works, thanks everybody that helped me out on this.

(C:

[EMAIL PROTECTED] wrote:

date(z); // the today's ordinal number 

z - day of the year; i.e. 0 to 365 

if you want the ordinal number of other days different than the current one
you can play with mktime or strftime or strtotime to make an appropiate 
timestamp as you did in your earlier codes.

 
- Original Message - 
From: Martin Towell [EMAIL PROTECTED]
To: GENERAL PHP LIST [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 3:19 AM
Subject: RE: [PHP] take date and convert to day of year


I'm running on WinNT4 w/ PHP 4.0.6 and the code I supplied came back with
333
and for today I get 317
dunno why you're getting 364
anyone, any eye-dears ??

-Original Message-
From: sundogcurt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 12:14 PM
To: GENERAL PHP LIST
Subject: Re: [PHP] take date and convert to day of year


I have tried to implement your code Martin, and I do thank you VERY MUCH 
for the help, but your code seems to have the same trouble as mine, it 
doesn't matter what date I start with, I end up with 364 as the day of 
the year, I am on win32 though I don't know if that matters.

Here is what I tried:


//FORMAT HAS TO BE date(d-M-Y);
//GET DAY OF YEAR FOR DOB utime = UNIX time
$utine = strtotime(30-Nov-1971);
$dob = getdate($utime);
$dobnum = $dob['yday'];
print dob is  . $dobnum . br;

//GET DAY OF YEAR FOR TODAY
//$today = date(d-M-Y);
$utoday = strtotime(date(d-M-Y));
$today = getdate($utoday);
$todaynum = $today['yday'];
print today is  . $todaynum . br;

There should be a different of about 17 days here right? Not if this is 
returning 364 for $dobnum, then it's 48!


[EMAIL PROTECTED] wrote:

looking at the manual, getdate() is meant to be passed a unix time stamp,
so, you'll need to use strtotime() first thus:

$utime = strtotime(30-Nov-1971);
$dob = getdate($utime);
$dobnum = $dob['yday'];
print $dobnum;

Notice I changed the format of the date, when I tried using the original
format, strtotime() complained, saying it couldn't convert it.

Martin T

-Original Message-
From: sundogcurt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 7:57 AM
To: GENERAL PHP LIST
Subject: [PHP] take date and convert to day of year


Hi guys, I know that you can take todays date and display it as the 
numeric day of the year, 1 - 365 / 0 - 364 etc.
But can you take a date such as (November-30-1971) and convert that to 
the numeric day of the year?

I have been trying to do this but have had no joy, I don't think my code 
is even close.

$dob = getdate(Nov-30-1971);
$dobnum = $dob['yday'];
print $dobnum;

$dob 'should' be an array and 'yday' should be the numeric value for the 
day of the year, right?!?

This is what I am trying, and how I understand it, using 'yday' should 
give you basically the same output as date (z);

What I would like is the ability to convert any date to the days numeric 
value. Any help would be GREATLY appreciated.

(C:




-- 
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] take date and convert to day of year

2001-11-13 Thread sundogcurt

Hi guys, I know that you can take todays date and display it as the 
numeric day of the year, 1 - 365 / 0 - 364 etc.
But can you take a date such as (November-30-1971) and convert that to 
the numeric day of the year?

I have been trying to do this but have had no joy, I don't think my code 
is even close.

$dob = getdate(Nov-30-1971);
$dobnum = $dob['yday'];
print $dobnum;

$dob 'should' be an array and 'yday' should be the numeric value for the 
day of the year, right?!?

This is what I am trying, and how I understand it, using 'yday' should 
give you basically the same output as date (z);

What I would like is the ability to convert any date to the days numeric 
value. Any help would be GREATLY appreciated.

(C:


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




Re: [PHP] take date and convert to day of year

2001-11-13 Thread sundogcurt

I have tried to implement your code Martin, and I do thank you VERY MUCH 
for the help, but your code seems to have the same trouble as mine, it 
doesn't matter what date I start with, I end up with 364 as the day of 
the year, I am on win32 though I don't know if that matters.

Here is what I tried:


//FORMAT HAS TO BE date(d-M-Y);
//GET DAY OF YEAR FOR DOB utime = UNIX time
$utine = strtotime(30-Nov-1971);
$dob = getdate($utime);
$dobnum = $dob['yday'];
print dob is  . $dobnum . br;

//GET DAY OF YEAR FOR TODAY
//$today = date(d-M-Y);
$utoday = strtotime(date(d-M-Y));
$today = getdate($utoday);
$todaynum = $today['yday'];
print today is  . $todaynum . br;

There should be a different of about 17 days here right? Not if this is 
returning 364 for $dobnum, then it's 48!


[EMAIL PROTECTED] wrote:

looking at the manual, getdate() is meant to be passed a unix time stamp,
so, you'll need to use strtotime() first thus:

$utime = strtotime(30-Nov-1971);
$dob = getdate($utime);
$dobnum = $dob['yday'];
print $dobnum;

Notice I changed the format of the date, when I tried using the original
format, strtotime() complained, saying it couldn't convert it.

Martin T

-Original Message-
From: sundogcurt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 7:57 AM
To: GENERAL PHP LIST
Subject: [PHP] take date and convert to day of year


Hi guys, I know that you can take todays date and display it as the 
numeric day of the year, 1 - 365 / 0 - 364 etc.
But can you take a date such as (November-30-1971) and convert that to 
the numeric day of the year?

I have been trying to do this but have had no joy, I don't think my code 
is even close.

$dob = getdate(Nov-30-1971);
$dobnum = $dob['yday'];
print $dobnum;

$dob 'should' be an array and 'yday' should be the numeric value for the 
day of the year, right?!?

This is what I am trying, and how I understand it, using 'yday' should 
give you basically the same output as date (z);

What I would like is the ability to convert any date to the days numeric 
value. Any help would be GREATLY appreciated.

(C:





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




Re: [PHP] silly question

2001-11-13 Thread sundogcurt

Take care to be sure that you make the update, before the rest of the 
page loads, things happen in order, so it's almost like creating your 
page backwards (I just had that problem).
I can elaborate if you like.

(C:

[EMAIL PROTECTED] wrote:

Hi list,

I have PHP code to insert the result of a form into mysql. When I nedd to
made an update, I pass an id in the url and use it to make the update
query. The problem is after I click in the update button (input submit) my
page refresh and came back in the same state, to see the changes I need to
type in the url again with the parameter?? why?? There's a way to avoid this
and get a new blank form page after the update?

ps: I've stored the id in a input type hidden, so I could click the button
and still have the id

Thank's in advance

Rodrigo Peres




-- 
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] Date help (no not that kind)

2001-11-10 Thread sundogcurt

I am trying to determine if todays date ($today) is within a week 
($startcheck) of a given date ($dob). This is what I have so far.

$todaydate = (date(Y-d-m));
$today = strtotime($todaydate);
// $today prior to strtotime = 2001-10-11
$startcheck = strtotime(2001-08-11);
$dob = strtotime(2001-15-11);

//$today is CLEARLY between the two dates I'm testing with but no is 
always returned.

if($today = $dob  $startcheck = $today) {
print yes;
}
else {
print no;
}

Here are the values assigned to the vars, why is $today so much smaller 
than $startcheck and $dob?

1002783600 = today
1005452940 = startcheck
1005451980 = dob

win32 php4

Thanks in advance


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