[PHP-DB] How can I get in PHP the number of files in a directory

2006-05-31 Thread suad

Hi,

This is for reading a file:
?php
$handle = fopen(/home/rasmus/file.gif, r);
?

How can I get in PHP the number of files in the directory (rasmus)
and the files names in a loop?

Thanks
Suad

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



Re: [PHP-DB] How can I get in PHP the number of files in a directory

2006-05-31 Thread Stut

suad wrote:


This is for reading a file:
?php
$handle = fopen(/home/rasmus/file.gif, r);
?

How can I get in PHP the number of files in the directory (rasmus)
and the files names in a loop? 



http://php.net/glob or http://php.net/readdir

-Stut

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



Re: [PHP-DB] How can I get in PHP the number of files in a directory

2006-05-31 Thread Brad Bonkoski

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

suad wrote:


Hi,

This is for reading a file:
?php
$handle = fopen(/home/rasmus/file.gif, r);
?

How can I get in PHP the number of files in the directory (rasmus)
and the files names in a loop?

Thanks
Suad



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



Re: [PHP-DB] allow-url-fopen setting

2006-05-31 Thread Brad Bonkoski



Manoj Singh wrote:


Hello all,

Can i change the allow-url-fopen(php.ini variable) setting through php
code.

If any one knows how to do that, please help me.

Regards
Manoj


http://www.php.net/manual/en/ref.filesystem.php
from manual
Note: This setting can only be set in php.ini due to security reasons.

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



[PHP-DB] Combining Fields

2006-05-31 Thread Grae Wolfe - PHP
Good Day!
  I am trying to use my limited knowledge to create a VERY simple process to 
display some of the information in my table, allow a particular record to be 
selected, then opened on a page with text boxes to edit the information, 
after which the UPDATE command will be used to update the database.
  That being said, I have a way that I think this will work, but I don't 
have a unique record number in my table for each of the entries.  I have 
tried getting PHPMyAdmin to set this up, but I cannot seem to make it work. 
SO - I need to try to create that ID on the fly.  I figured I could just 
combine the first and last names to make this ID, but I am not sure what the 
syntax should be.  Here is the code I have dealing with defining the 
variables...

Any help or thoughts would be splendid!

while ($row = mysql_fetch_array($result)) {
 $id = $row['last_name'],$row['first_name'];
 $fname = $row['first_name'];
 $lname = $row['last_name'];

 $option_block .= option value=\$id\$lname, $fname/option;


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



Re: [PHP-DB] Combining Fields

2006-05-31 Thread Brad Bonkoski



Grae Wolfe - PHP wrote:


Good Day!
 I am trying to use my limited knowledge to create a VERY simple process to 
display some of the information in my table, allow a particular record to be 
selected, then opened on a page with text boxes to edit the information, 
after which the UPDATE command will be used to update the database.
 That being said, I have a way that I think this will work, but I don't 
have a unique record number in my table for each of the entries.  I have 
tried getting PHPMyAdmin to set this up, but I cannot seem to make it work. 
SO - I need to try to create that ID on the fly.  I figured I could just 
combine the first and last names to make this ID, but I am not sure what the 
syntax should be.  Here is the code I have dealing with defining the 
variables...


Any help or thoughts would be splendid!

while ($row = mysql_fetch_array($result)) {
$id = $row['last_name'],$row['first_name'];
$fname = $row['first_name'];
$lname = $row['last_name'];

$option_block .= option value=\$id\$lname, $fname/option;


 


Use the dot (.) for appending variables...
so it would be:
$id = $row['last_name'].$row['first_name'];
...or course if you want that would look like this: 'SmithAdam'
if you want 'Smith,Adam' as your id then:
$id = $row['last_name'].,.$row['first_name'];
-Brad

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



Re: [PHP-DB] Combining Fields

2006-05-31 Thread Grae Wolfe - PHP
Thank you Brad - That is what I was looking for, but now that I see how it 
behaves, I am thinking that it isn't going to work the way I wanted.  I need 
to then be able to pass the ID back to MySQL so that it will retrieve just 
the one record for editing.

I guess I need to go back to making the DB create an auto-incrementing ID 
number.  Hmmm...

Thanks!!


Brad Bonkoski [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]


 Grae Wolfe - PHP wrote:

Good Day!
  I am trying to use my limited knowledge to create a VERY simple process 
 to display some of the information in my table, allow a particular record 
 to be selected, then opened on a page with text boxes to edit the 
 information, after which the UPDATE command will be used to update the 
 database.
  That being said, I have a way that I think this will work, but I don't 
 have a unique record number in my table for each of the entries.  I have 
 tried getting PHPMyAdmin to set this up, but I cannot seem to make it 
 work. SO - I need to try to create that ID on the fly.  I figured I could 
 just combine the first and last names to make this ID, but I am not sure 
 what the syntax should be.  Here is the code I have dealing with defining 
 the variables...

Any help or thoughts would be splendid!

while ($row = mysql_fetch_array($result)) {
 $id = $row['last_name'],$row['first_name'];
 $fname = $row['first_name'];
 $lname = $row['last_name'];

 $option_block .= option value=\$id\$lname, $fname/option;



 Use the dot (.) for appending variables...
 so it would be:
 $id = $row['last_name'].$row['first_name'];
 ...or course if you want that would look like this: 'SmithAdam'
 if you want 'Smith,Adam' as your id then:
 $id = $row['last_name'].,.$row['first_name'];
 -Brad 

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



Re: [PHP-DB] Combining Fields

2006-05-31 Thread Brad Bonkoski



Grae Wolfe - PHP wrote:

Thank you Brad - That is what I was looking for, but now that I see how it 
behaves, I am thinking that it isn't going to work the way I wanted.  I need 
to then be able to pass the ID back to MySQL so that it will retrieve just 
the one record for editing.


I guess I need to go back to making the DB create an auto-incrementing ID 
number.  Hmmm...


Thanks!!

 

Well, the unique ID would probably be the *best* way to go, but you 
could also get the record with the below solution, of course this 
requires every combination of first and last name is unique...

if you do:
$id = Smith,Adam
Then:
list($fname, $lname) = explode(,,$id);
select * from table where first_name = '$fname' and last_name='$lname'
would do the trick...
Of course this has many what-ifs asociated with it...all of which 
would be taken care of with an auto-incrementing/primary key ID field 
for wach record ;-)


-Brad

Brad Bonkoski [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 


Grae Wolfe - PHP wrote:

   


Good Day!
I am trying to use my limited knowledge to create a VERY simple process 
to display some of the information in my table, allow a particular record 
to be selected, then opened on a page with text boxes to edit the 
information, after which the UPDATE command will be used to update the 
database.
That being said, I have a way that I think this will work, but I don't 
have a unique record number in my table for each of the entries.  I have 
tried getting PHPMyAdmin to set this up, but I cannot seem to make it 
work. SO - I need to try to create that ID on the fly.  I figured I could 
just combine the first and last names to make this ID, but I am not sure 
what the syntax should be.  Here is the code I have dealing with defining 
the variables...


Any help or thoughts would be splendid!

while ($row = mysql_fetch_array($result)) {
$id = $row['last_name'],$row['first_name'];
$fname = $row['first_name'];
$lname = $row['last_name'];

$option_block .= option value=\$id\$lname, $fname/option;



 


Use the dot (.) for appending variables...
so it would be:
$id = $row['last_name'].$row['first_name'];
...or course if you want that would look like this: 'SmithAdam'
if you want 'Smith,Adam' as your id then:
$id = $row['last_name'].,.$row['first_name'];
-Brad 
   



 



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



Re: [PHP-DB] Combining Fields

2006-05-31 Thread Grae Wolfe - PHP
Again, my many thanks - I didn't know about the 'explode' function - that 
may be a huge help.

Hopefully, I am on the right track now...  thanks!



Brad Bonkoski [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]


 Grae Wolfe - PHP wrote:

Thank you Brad - That is what I was looking for, but now that I see how it 
behaves, I am thinking that it isn't going to work the way I wanted.  I 
need to then be able to pass the ID back to MySQL so that it will 
retrieve just the one record for editing.

I guess I need to go back to making the DB create an auto-incrementing ID 
number.  Hmmm...

Thanks!!


 Well, the unique ID would probably be the *best* way to go, but you could 
 also get the record with the below solution, of course this requires every 
 combination of first and last name is unique...
 if you do:
 $id = Smith,Adam
 Then:
 list($fname, $lname) = explode(,,$id);
 select * from table where first_name = '$fname' and last_name='$lname'
 would do the trick...
 Of course this has many what-ifs asociated with it...all of which would 
 be taken care of with an auto-incrementing/primary key ID field for wach 
 record ;-)

 -Brad

Brad Bonkoski [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Grae Wolfe - PHP wrote:


Good Day!
 I am trying to use my limited knowledge to create a VERY simple process 
 to display some of the information in my table, allow a particular 
 record to be selected, then opened on a page with text boxes to edit 
 the information, after which the UPDATE command will be used to update 
 the database.
 That being said, I have a way that I think this will work, but I don't 
 have a unique record number in my table for each of the entries.  I 
 have tried getting PHPMyAdmin to set this up, but I cannot seem to make 
 it work. SO - I need to try to create that ID on the fly.  I figured I 
 could just combine the first and last names to make this ID, but I am 
 not sure what the syntax should be.  Here is the code I have dealing 
 with defining the variables...

Any help or thoughts would be splendid!

while ($row = mysql_fetch_array($result)) {
$id = $row['last_name'],$row['first_name'];
$fname = $row['first_name'];
$lname = $row['last_name'];

$option_block .= option value=\$id\$lname, $fname/option;




Use the dot (.) for appending variables...
so it would be:
$id = $row['last_name'].$row['first_name'];
...or course if you want that would look like this: 'SmithAdam'
if you want 'Smith,Adam' as your id then:
$id = $row['last_name'].,.$row['first_name'];
-Brad

 

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



[PHP-DB] Re: Open a file?

2006-05-31 Thread The Panister
Well
You may try this:

First you can make a form and add the option to write to the file hidden in
the form... just like that:


form method=post action=Action_File.php

input type=hidden name=theText Value=The Page has been visited at
?php
$today = getdate();
print_r($today);
?   br

input type=submit value=Post Data

/form
-
Then the Action File should be contain some thing like that:
?php
// Here we get the information in about when the page visited.
$theText = $_POST[theText];

$theText = stripslashes($theText);

// Here we open the file...  Of course you will change the $filename with
the name of your file that you want the text to be written in it.
$data = fopen($filename, a);

// And here we write the data.
fwrite($data,$theText);

// And here we close the file.
fclose($data);

?

That's All.

Of course you can modify and enhance the code to meet your needs
I wish this help you.

The Panister!

Wim Van Geyt [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 I want to send a choice to a textfile in php.
 Now i don't know how to let the button communicate with the php script?
 And do i have to write the script in the same page as the page where i
have writed the radiobuttons?

 Does anyone knows an answer ?

 Thanks
 Crazydj
 -
 Mail.be, WebMail and Virtual Office
 http://www.mail.be

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