Jump to content

teamv

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

teamv's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ah that makes a lot more sense than a plus sign , I should have tried to think through the logic of what was happening in the function rather than just making a change like I did, sorry. I have now made the changes given above though and all is working well! Well thanks for sticking with me guys, and for all your help. You've been great! Richard
  2. Oh, well I did try theirs first but it was sorted in the opposite order than I wanted. I then tried changing the - to a + sign as I expected that to switch it round, but it didn't. What I am missing? Thanks for all your help support thus far!
  3. Thank you for the advice, so to clarify I should change uasort to usort instead?
  4. Thank guys, it worked perfectly! I used: // function to sort the array by time function mysort($a,$b){ return $a['time'] < $b['time']; } // sort the array uasort($array,'mysort'); Thanks again!
  5. Thank you so much for the quick responses! I will have a go at implementing the above examples and let you both know how it goes.
  6. Hi all, I have a large array filled with other arrays, each of which is slightly different, but they all have an index "time" which is a unix timestamp. Is there any easy function which will sort this arrays of array for me by that time index (highest to lowest), or will I have to use some kind of more complex recursive algorithm? Would greatly appreciate any advice people can offer me on this question. Thanks in advance for any and all suggestions. Richard
  7. Ah, I had foolishly not noticed that the form on the page did not contain: enctype="multipart/form-data" I think its all working now I can print the $_FILES array so will try uploading now.
  8. Hi thanks for your script, unfortunately its the very first step that is not working so I can only make minimal use of it at the moment. The whole $_FILES thing just doesn't seem to be working for me. if (isset($_POST['imagefile'])) { $_SESSION['test'] = $_FILES['imagefile']['tmp_name']; } That returns nothing, just a blank space when I echo it. The next bit of code: if (isset($_POST['imagefile'])) { $_SESSION['test'] = $_POST['imagefile']; } Returns the name of the image (e.g Sunset.jpg), but the $_FILES just won't work. Do you (or anyone) have any idea why? Thanks again for your last reply.
  9. Hi all, I am trying to upload an image using html/php (within a CMS as a mod), but I am having problems with it. The HTML is easy: <input name="imagefile" type="file" /> However, in the PHP the $_FILES code isn't working. If I try to echo $FILES['imagefile']['tmp_name'], or any other file attributes like type/name etc it doesn't echo anything. If I echo $_POST['imagefile'] though it does show me the image name, so it is passing it across I'm just not sure why any of the $_FILES stuff isn't working. It is working fine in a mod on another page of the CMS, but I can't see why this isn't so I'm a bit stuck. Does anyone have any ideas? Any and all suggestions welcome. Thanks!
  10. By the way this is a time limit on that small function call, not the entire script. I had found a set_time_limit but that works only for the whole script. Anyone have any ideas?
  11. Hi all, Is there any way I can set a time limit on a file_get_contents call? Basically I'm runing a query on geo-coding API and extracting the co-ordinates from the resulting string. Heres the code: $geoquery = "thequery"; $georesult = file_get_contents("http://www.theapi.com/?$geoquery"); preg_match_all('/-?(?:\d+)?\.\d+/', $georesult, $coordinates); $longitude = $coordinates[0][0]; $latitude = $coordinates[0][1]; When the postcode is valid it returns the string from which I can extract the co-ordinates. However when it is invalid it does not, it simply keeps trying and trying and eventually the connection to the api is blocked with 'connection refused in xxxx'. I was wondering if there was any way that I could set a time limit on the file_get_contents request? For example to say that if its still running 7 seconds later to stop trying and and move onto the next loop. Any ideas?
  12. edit: Nevermind I have found it, an 'array within an array' Thanks for all your help!
  13. I'm using an API to return co-ordinates of a postcode I gave it. Here is the result: $georesult = "map.centerAndZoom(new GPoint(-1.5234513, 53.432567), 4)"; I have built a regular expression to extract the individual co-ordinates: -\d*[\.\d,\s]* Which matches "-1.565323, 53.811008", and I was then planning to explode the string using ", " as the delimiter to extract the individual co-ordinates. However I'm having trouble using the regualr expressions functions preg_match and preg_split. I just seem to be going round in circles I just don't quite undertsand how I am supposed to use them, and deal with their output/data structure. Could anyone advise me on what/how I call the correct preg (or another type of) function to extract the text with the delimeter provided please? Would be greatly appreicated. Thanks!
  14. Hi all, I am constructing a mashup and would like to access the google local API to get much of my information. While google does not offer it as part of its API I have found a wrapper class on SourceForge that you can use to query it apparently. Here it is: www.varidev.co.uk/GoogleLocalAPI-0.7.1.class.php.zip However, I'm not really sure how to access it as no README was provided. I have tried creating an instance of the class in a test script but it says class is 'non-existent', and as I've just never used objects in php before so don't really know where to start with debugging. Could anyone take a quick look at the script please and help me to figure out how to utilise it? Would be greatly appreciated. Thanks.
×
×
  • 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.