Jump to content

Nodral

Members
  • Posts

    397
  • Joined

  • Last visited

Posts posted by Nodral

  1. Just out of curiosity,

     

    How does

    <?php
    $file = 'filename.php';
    if (isset($_POST['number']) && $_POST['number'] == '1')
    {    
    include($file);
    }
    ?>

     

    And

    <?php    
    $a = '2';    
    if($_POST['number']==1){echo $a;}  
    ?>

     

    do what you want?  They perform completely different actions?

     

  2. Hi

     

    I've a directory structure which is root/web/dir1/dir2/dir3/sitefiles.php and root/tmp/tempfile.jpg

     

    Within sitefiles.php I have greated an image file and saved it successfully as tempfile.jpg.

     

    However, when I then try to call it back and include it in an HTML output from another script within dir3, I get an error saying it can't be found.  I have used exactly the same file path and I'm completely stumped as to why it's falling over.  Any ideas?

     

     

  3. Hi

     

    I'm desperately trying to get an FTP sorted, however for some reason I cannot write to the ftp file.  The file gets set up and saved correctly with the right permissions, however when I come to write to it I cannot get it to work.  I've tried fputs and fwrite but I'm getting nowhere fast

    <?php
    
    if($login){
    echo "connected";
    
    //make directory
    @ftp_mkdir($ftpstream,'tmp/test');
    
    // make temp file
    $temp=tmpfile();
    
    //upload temp file
    @ftp_fput($ftpstream,'tmp/promo.txt',$temp, FTP_ASCII);
    
    //make file writable
    ftp_site($ftpstream,"CHMOD 0777 tmp/promo.txt");
    
    //write to file
    $fp=fopen('tmp/promo.txt','w');
    fwrite($fp,"hello");
    fclose($fp);
    
    
    
    }
    else{
    echo"failed";
    }
    
    //Close connection
    
    ftp_close($ftpstream);
    
    ?>
    
    As mentioned, this connects fine, so there is nothing wrong with $login.  I have omitted this for my own security.

  4. Here is an excerpt from the textfile showing the bit I want. 

     

       
          Month to Date Summary UK
          From: 01/08/2011 00:00
          To: 18/08/2011 00:00
         
    
    
    
           
              Responses
         Overall
          Satisfaction
         Rent Next
          Time
         Recommend
              
          GB
         UK
         4344
         8.6
         8.6
         8.5
         69.1% <--------------------THIS IS THE FIGURE I NEED TO PASS TO MY SCRIPT AND CHANGES DAY BY DAY
         
          REGUK01 <-----------------THIS ONLY EVER APPEARS HERE
         London
         611
         8.5
         8.5
         8.4
         65.7%
         
          TERUK11
         Heathrow 
         253
         8.4
         8.4
         8.2
         61.9%
         
          LHRT01
         London 
         252
         8.4
         8.4
         8.2
         61.8%
         
          LHRT10
         Heathrow 
         1
         10.0
         10.0
         10.0
         100.0%
         
          TERUK12
         Central London Territory
         200
         8.7
         8.7
         8.6
         72.5%

  5. Hi All

     

    I'm absolutely cr@p at regex and to be quite honest I'm also being a bit lazy here as I'm on a short timescale and haven't got hours to read through loads of tutorials at the moment.  (I will be doing soon though coz it's not fair on you guys out there)

     

    I have a huge text file which I need to search through and find the statement REGUK01.  This will only ever appear once in the file. before this is 2 new lines and then a percentage.  I need to be able to pull this particular percentage out.  eg, it's 69.1% this time, however this changes on a daily basis and I receive a new text file every day.

     

    Any thoughts / ideas / help?

  6. I've tried this, and it runs fine when double clicked.

     

    However, I am trying to set it up as a rule in Outlook to perform an action when I receive an email each day.  There is an error appearing in the command window but it pops up and closes so quick that I have no idea what the issue is.

     

    Any ideas how I can either slow it down, keep the window open or another method?

  7. Hi all

     

    I am trying to automate a process and need to know if it is possible to create an exe file which will run a php file for me.

     

    I've had a bit of a google, but as I don't understand command line stuff, I'll struggling to mae head nor tail of it.

     

    Any help would be appreciated.

  8. You need to do the following

     

    if(strlen($criteria)) {	    
    $sql    = "SELECT * FROM `tbl` AS s  WHERE ".$criteria;
    // insert the next line to help you debug
    echo $sql;
    
    $rs     = executeSql($sql); 	    
    while($row = mysql_fetch_array($rs)) {		
    $searchdetails[] = $row;	    
    }	
    }	
    return $searchdetails;    
    }	
    

     

    Does the SELECT statement read as you expect it to? 

    Is this why you are not getting the information as you would expect?

     

    Try this, and then post the SELECT statement you see.  This will then indicate where your error could be.

  9. Hi Guys

     

    I need a goos Javascript tutorial as I'm required to use JS in a job I'm applying for.  I've googled but not sure which should be best.

     

    Any recommendations?  I have no knowledge whatsoever at the moment of JS

     

    Cheers

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.