Jump to content

Nodral

Members
  • Posts

    397
  • Joined

  • Last visited

Everything 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. http://php.net/manual/en/function.include.php
  3. why not include the PHP in the top of the called page prior to outputting the headers?
  4. 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?
  5. At first glance you have a missing single quote when you define $A And secondly, if you are using an include, you should be including a filename. include('foo.php');
  6. $clean=implode('\',"\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\"); $cleaner=explode($clean); Dirty, but does the job
  7. 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.
  8. 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%
  9. 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?
  10. I've sorted it cheers. I had to put an absolute path in to the php.exe file as the command prompt was running from witihin a system folder rather than from where the bat file was saved. Cheers for the help
  11. 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?
  12. 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.
  13. I think before anyone even thinks about replying to this you'll need to tidy your post up and make your code readable. Put some linebreaks and some whitespace in so we can see what's going on.
  14. Sorry, missed that bit of the post. oops!!! Cheers for the correction.
  15. <?php $filename="image.jpg"; $split=explode(".",$filenames"); $name=$split[0]; $extension=$split[1]; ?>
  16. Ok, you seem to be over complicating this by passing an array to your function. You'd be better to just pass it as 2 variables. eg function SearchResults($category, $state){ // // // // // // // }
  17. 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.
  18. Put some sort of test into your script which will echo out the SELECT statement which you are running. See if you can fathom where the error is coming from after doing that, if not just post it on here and I'll have another look
  19. Hi Does anyone know of a beginners OOP tutorial out there? I've tried Google, but I tend to get lost on page 2 of the majority of stuff I find.
  20. Change the OR statements to AND. Therefore you will only SELECT if all critera are true. With OR it will select as long as one out of the criteria are true.
  21. I'd say a way to make this easier would be to have all the data in a DB then select from it and use ORDER BY
  22. I use EditPlus, Just the colour coding and the brace highlighting helps me spot errors. No nasty pop-ups and any autocompletions can be switched off if not required.
  23. 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.