User Profile

Collapse

Profile Sidebar

Collapse
gsaray101
gsaray101
Last Activity: May 8 '08, 09:50 PM
Joined: Aug 22 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • gsaray101
    replied to Mysql db restore
    in PHP
    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 ....
    See more | Go to post
    Last edited by Atli; May 9 '08, 06:16 AM. Reason: Changed [code] tags to [code=php].

    Leave a comment:


  • gsaray101
    replied to Mysql db restore
    in PHP
    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]
    See more | Go to post
    Last edited by Atli; May 9 '08, 06:15 AM. Reason: Added [code] tags.

    Leave a comment:


  • gsaray101
    replied to Mysql db restore
    in PHP
    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.sql
    See more | Go to post

    Leave a comment:


  • gsaray101
    started a topic Mysql db restore
    in PHP

    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";...
    See more | Go to post
    Last edited by Atli; May 9 '08, 06:22 AM. Reason: Changed [code] tags to [code=php].

  • gsaray101
    replied to replace characters starting from undercore
    in PHP
    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?
    See more | Go to post

    Leave a comment:


  • gsaray101
    replied to replace characters starting from undercore
    in PHP
    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.
    See more | Go to post

    Leave a comment:


  • gsaray101
    replied to replace characters starting from undercore
    in PHP
    thanks, it worked. Re: has significance.
    See more | Go to post

    Leave a comment:


  • gsaray101
    started a topic replace characters starting from undercore
    in PHP

    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
    See more | Go to post

  • $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 2
    See more | Go to post

    Leave 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);
    ...
    See more | Go to post
    Last edited by Atli; May 5 '08, 10:06 PM. Reason: Changed [code] tags to [code=php].

  • gsaray101
    started a topic PHP to write errors to windows event log
    in PHP

    PHP to write errors to windows event log

    Can someone help me with writing a php script to write errors to windows event log?
    See more | Go to post

  • 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;
    }
    }
    ...
    See more | Go to post
    Last edited by acoder; Feb 12 '08, 08:26 AM. Reason: Added code tags

    Leave a comment:


  • I keep getting:

    "Object doesn't support this property or method" error
    See more | Go to post

    Leave 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");
    ...
    See more | Go to post

  • gsaray101
    replied to text manipulation
    in .NET
    I am using vb and handling it on the server side
    See more | Go to post

    Leave a comment:


  • gsaray101
    started a topic text manipulation
    in .NET

    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.
    See more | Go to post

  • 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...
    See more | Go to post
    Last edited by pbmods; Sep 20 '07, 10:49 PM. Reason: Added CODE tags.

  • 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,
    See more | Go to post

  • gsaray101
    started a topic Connecting to ms sql server with perl
    in Perl

    Connecting to ms sql server with perl

    Can anybody tell me how can I connect to MS SQL server with perl?
    See more | Go to post

  • gsaray101
    started a topic CSV to RDD file
    in 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;...
    See more | Go to post
    Last edited by miller; Aug 29 '07, 11:21 PM. Reason: Code Tag and ReFormatting
No activity results to display
Show More
Working...