Jump to content

Nick11380

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Nick11380's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks to all for their help. Posting the code would be time wasting because the code on both sites is identical therefore the coding is irrelevant (as it works on one site). I have managed to fix this by adding a php file to my website's root folder and then iframing it. I'm now thinking that this is a problem with WordPress as opposed to my website's i.p address.
  2. Isn't this entirely irrelevant if the code on both pages is identical? It's something outside of the code that is breaking this, and I'm now convinced it's the domain's i.p that has been blocked.
  3. The problem I am having is bizarre. The PHP code on both of these pages displays the gold price in grams and ounces. http://www.goldprices.org.uk/gold-1/ http://www.goldspotprice.org.uk/gold-2/ /gold-2 works perfectly. /gold-1 breaks when the page is refreshed. As I say, the code is absolutely identical on both pages, however one domain breaks the code and the other does not seem to break the code. Does anyone have a clue what is happening here?
  4. Simple! Thank you very much buddy, much appreciated!
  5. I'm really struggling to see how to do this. The following number is being posted: As of <span id="theTime"></span> GMT, the gold price per ounce</a> in the UK is £'.$results['ounce_price']; I want 'ounce_price' to be rounded to decimal places but can't figure how to do this. Does 'round($results,2) ' mean anything in this situation? Where can I place the code. I'm a little confused, any help would be hugely appreciated!
  6. All fixed, a dude from devnet gave the answer. The script returned a value of '1' because it couldn't deal with numbers over 999. I needed to add this to the $ounce_price = $ounce_price = preg_replace('/[^-0-9.]/','',$nodes[0][1]);
  7. How would I go about that? <?php var_dump($ounce_price); ?> ? (sorry, I'm very new to PHP)
  8. Thanks for the reply Pikachu. Unfortunately that hasn't worked. It's so odd how $ounce_price returns a value but if you try to multiply it, it reverts to '1'. I am willing to pay a small amount for anyone who could run through the entire code and spot the problem. I'm racking my brain thinking about this one.
  9. I have gold data being reported here goldprices.org.uk (scroll down near the bottom). Recently it broke for no apparent reason. I checked the scraper and everything seems to be OK. The issue is that the gold price in (troy) ounces is being scraped fine - however to work out the price in grams you must multiply by 0.0321 (grams in a troy ounce). The code looks like this: $ounce_price = null; $grams_price = null; if(count($nodes) == 1 && $nodes[0][1]) { $ounce_price = $nodes[0][1]; $grams_price = $ounce_price * 0.0321; However $ounce_price * 0.0321 breaks the code and returns '0.0321'. I then tried the code: $ounce_price = null; $grams_price = null; if(count($nodes) == 1 && $nodes[0][1]) { $ounce_price = $nodes[0][1]; $grams_price = $ounce_price + 1; And the code returned the value '2'. So it appears that when $ounce_price is being multiplied/subtracted etc it reverts to a value of '1'. However if I do $grams_price = $ounce_price the value is the correct ounce price. I'm so confused as to why when adding an equation to $ounce_price the value reverts to '1' as opposed to equalling the correct number. Any help here would be HUGELY appreciated - I've been stuck for several days and only just decided to ask online :s Nick
×
×
  • 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.