when I do:
[code=php]
$dir = opendir("$dir2" );//List files in images directory
while (($file = readdir($dir)) !== false){
echo "file name is $file\n";
closedir($dir);
[/code]
I am not getting all of the files in that directory. I have two actual files and it is only displaying the first one.
this is the output:
file name is ....
User Profile
Collapse
-
-
the part that ftp gets all files into d:\cacti\backup works. I need to go throught each file and create a mysqldb based on the file name. I would like to do something like this in php. This piece of code works in perl. Can any body help?
[code=perl]
opendir(DIR, "$dir2");
@files = readdir(DIR);
closedir(DIR);
foreach $file (@files) {
[/code]Leave a comment:
-
I found one problem where $fn variable was not defined. I changed it to $file and I am getting a more meaningfull error now:
Code:Access denied for user 'cactiuser'@'localhost' to database 'sbkesmgendev01' Error creating database: Access denied for user 'cactiuser'@'localhost' to database 'sbkesmgendev01' mysql -u {$username} -p{$password} {$database} < {$file}SBKESMGENDEV01_20080508.sqlLeave a comment:
-
Mysql db restore
I am trying to set up one server with multiple mysql dbs. This script will get the mysqldump files from the ftp server and based on the name of the server in the file, it will create the corresponding db on the server.
this is the code
[CODE=php]
<?php
#ftp the most recent file to the ftp server
$dir1="/patrol_media/patadmin/sqlbak";
$dir2="d:\\cact i\\backup";... -
I am basically trying to do what mdel does in regular ftp program:
ftp ftp.server.com
prompt
mdel servername*
file name is in this format: servername_date .sql
Before uploading files to the ftp server, I would like to be able to remove the previous version to only keep one copy in the ftp server.
can anybody help?Leave a comment:
-
I have one more question:
The reason I removed _numbers is to login to ftp server, search for file names matches the servername and remove them.
then ftp_put the current file. I want to keep one copy on the ftp server.
Can I do?
ftp_delete($con n_id, $file*)
$file is the server name part.Leave a comment:
-
-
replace characters starting from undercore
There is a file name like servername_2008 0506.sql. I would like to remove every character starting from underscore, just leaving the servername. Can somebody help me with this in php?
Thanks,
mike -
$dir = "d:\\cacti\\sql bak";
still the same error.
PHP Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\perl_
scripts\list_fi le.php on line 2
PHP Parse error: syntax error, unexpected T_STRING in C:\perl_scripts \list_file
.php on line 2Leave a comment:
-
PHP Warning: Unexpected character in input: '\' (ASCII=92)
I keep getting PHP Warning: Unexpected character in input: '\' (ASCII=92)) this error on windows platform. this script works fine on Linux. Can anybody help? This script is supposed to return the most current file in d:\cacti\sqlbak directory.
[CODE=php]
<?php
$dir = d:\\cacti\\sqlb ak;
$pattern = '/sql/';
$newstamp = 0;
$newname = "";
$dc = opendir($dir);
... -
PHP to write errors to windows event log
Can someone help me with writing a php script to write errors to windows event log? -
this should be straight forward but it does not seem to be working:
[code=javascript]function function_checka ll()
{
var chk=document.ge tElementById("f orm1");
var chk1=chk.lstExc hange;
var chk2=chk.btnRad io100;
if (chk2.checked ==true ){
for (i=0; i<26; i++)
{
chk1[i].checked=true;
}
}
...Leave a comment:
-
I keep getting:
"Object doesn't support this property or method" errorLeave a comment:
-
need help with radiolist and checkboxlist in javascript
I have an asp.net page that has one radiolist (called lstcheck) and one checkboxlist (call lstExchange). Depending on the which radiolist item is checked, I need to clear the checkbox list or check them all. I have this function so far but it is not working:
...Code:function checkAll() { var radiolist=document.getElementById("lstCheck"); var checklist=document.getElementById("lstExchange"); -
-
text manipulation
I have an array like this in asp.net.
sqlstr=value1, value2, value3, value4
I would like to convert sqlstr to the following:
sqlstr=avg(valu e1), avg(value2, avg(value3), avg(value4)
Can you help me, I am a new bie. -
RE: function to go through each element of the array
Hi:
I am very newvie to PHP and I need help with arrays. what I am tryting to do is, connect 2 different mysql db, get the results and compare the results. Is there a function to go trough each element of the array rather than having loops?
For example, below is a code snap shot that does something like this: [code=php]if ($myrow = mysql_fetch_arr ay($result1)){[/code]
this is not working for me. This probably... -
how to compare two different fields from two different mysql db
There are two different my sql dbs running on two different machines. I need to connect to both mysql dbs and check if one system is on the other mysql db with one sql stament.
I am a just learning PHP. Can you please help me with this. Is this doable with one sql stament?
thanks, -
Connecting to ms sql server with perl
Can anybody tell me how can I connect to MS SQL server with perl? -
CSV to RDD file
I getting one file and inserting that into rrd file using rrdtool. It looks like the last line in the csv file is not being updated in the rrd file.
[CODE=perl]
open (IFILE,"<test.c sv");
while (<IFILE>) {
if (/^[0-9]/) {
($datetime, $val1, $val2, $val3, $val4, $val5) = split /,/, $_;
($date, $time) = split / /, $datetime;
($year, $month, $dayOfMonth) = split /-/, $date;...
No activity results to display
Show More
Leave a comment: