Jump to content

simonp

Members
  • Posts

    132
  • Joined

  • Last visited

Everything posted by simonp

  1. I want to add another item to the order_lines array but however I do it I end up with an error: $data = [ 'purchase_country'=>$company_country, 'purchase_currency'=>$currency_nm, 'order_amount'=>$api_amount, 'locale'=>"en-GB", 'order_tax_amount'=>0, 'order_lines'=>[ [ 'name'=>$product_name, 'quantity'=>1, 'unit_price'=>$api_amount, 'tax_rate'=>0, 'total_amount'=>$api_amount, 'total_tax_amount'=>0 ] ], "intent"=>"buy" ]; I thought this would work: 'order_lines'=>[ [ 'name'=>$product_name, 'quantity'=>1, 'unit_price'=>$api_amount, 'tax_rate'=>0, 'total_amount'=>$api_amount, 'total_tax_amount'=>0 ], [ 'name'=>$product_name2, 'quantity'=>1, 'unit_price'=>$api_amount2, 'tax_rate'=>0, 'total_amount'=>$api_amount2, 'total_tax_amount'=>0 ] ], "intent"=>"buy" ]; Any ideas please? Thanks!
  2. Thanks so much Barand - that works a treat. Would never have worked it out myself Cheers
  3. Hi gents, Thanks so much for your replies but sadly that doesn't work as it gives me everyone who is a Member of group 7 OR group 8 and I need to know who is in both group 7 AND group 8 (many people have multiple roles). Any ideas? Cheers
  4. Hello, We have a (complicated!) Drupal database in which users can be assigned multiple roles (member, leader, coordinator, etc) I have a query to get info about all our members (users_roles.rid = 7) but I need to get a list of people who are members AND leaders (users_roles.rid = 8 ) but this doesn't work: SELECT users.uid, users.`name`, users.mail, users.created, users_roles.rid, field_data_field_first_name.field_first_name_value, field_data_node_venue_region.node_venue_region_tid FROM users INNER JOIN users_roles ON users.uid = users_roles.uid INNER JOIN field_data_field_first_name ON field_data_field_first_name.entity_id = users.uid INNER JOIN field_data_node_venue_region ON field_data_node_venue_region.entity_id = users.uid WHERE users_roles.rid = 7 and users_roles.rid = 8 Any advice appreciated! Thanks.
  5. I'm trying to recreate the CSS for the form textfields and also the submit button used on this page: https://outdoorlads.com/user/register (ie the rounded corner text boxes and the red rounded corner submit button) I've tried trying to find these using page source in Safari with little success. Any help appreciated whilst I'm still getting to grips with CSS Thanks!
  6. Thanks so much requinx - that's really helpful. I'd got so close but didn't quite master the [0] part!
  7. Hi, I've got this JSON output: {"result":"success","clientid":null,"serviceid":null,"pid":null,"domain":"testdomain.com","totalresults":"1","startnumber":0,"numreturned":1,"products":{"product":[{"id":"3804","clientid":"1401","orderid":"3276","pid":"53","regdate":"2010-02-14","name":"Basic","groupname":"Plans","domain":"testdomain.com","dedicatedip":"","serverid":"4","servername":"serverx.com","serverip":"123.123.123.123","serverhostname":"","firstpaymentamount":"7.99","recurringamount":"7.99","paymentmethod":"wibble","paymentmethodname":"Credit\/Debit Card","billingcycle":"Monthly","nextduedate":"2010-02-14","status":"Terminated","username":"dcdqw","password":"z1nmY1p4Y9","subscriptionid":"","promoid":"0","overideautosuspend":"","overidesuspenduntil":"0000-00-00","ns1":"","ns2":"","assignedips":"","notes":"","diskusage":"0","disklimit":"1000","bwusage":"0","bwlimit":"50000","lastupdate":"2015-05-01 06:01:17","customfields":{"customfield":[{"id":"36","name":"ThisUserID","value":"1243214"}]},"configoptions":{"configoption":[]}}]}} ... and I'm trying to get the value for ThisUserID but I'm struggling so much with the arrays! I've copied it into http://jsonviewer.stack.hu so I can understand it more but just can't get that value. I understand: $clientid = $arr->clientid; ... but can't work out how to drill deeper. Any help appreciated
  8. Thanks folks. Apologies for the rookie coding errors - it's been a while I kept it simple and went with: // Assign plan_id if ($plan == "53") { $plan_id = "2"; } elseif ($plan == "54") { $plan_id = "3"; } elseif ($plan == "55") { $plan_id = "4"; }
  9. Hi, I want to set a variable based on the contents of another variable - I think I've see CASE used for this before but not entirely sure. Basically I'm trying to tidy this up: if ($var1 = "1") { $var2 = "a" } if ($var1 = "2" ) { $var2 = "b" } if ($var1 = "3") { $var2 = "c" } Any help appreciated. Thanks.
  10. Hi, I need the HTML on my page to start right up against the left hand side of the page - currently (with no formatting) it indents it a little. Any ideas how to get around this? Cheers Simon
  11. Cheers AlexWD, Unfortunately now it displayed the text escaped eg: Any tips? Simon
  12. Hi, In my MySQL db, I have sentences like: Dave's cat is called Flossy But the apostrophe is causing problems with my script - is there something I need to do when I get the data from the db to fix this? Cheers Simon
  13. Thanks - I was so close - I tried: echo $xml->geonameS->countryName; Thanks again. Simon
  14. Cheers - I'm using: <?php function xml2array($xml) { $arXML=array(); $arXML['name']=trim($xml->getName()); $arXML['value']=trim((string)$xml); $t=array(); foreach($xml->attributes() as $name => $value) $t[$name]=trim($value); $arXML['attr']=$t; $t=array(); foreach($xml->children() as $name => $xmlchild) $t[$name]=xml2array($xmlchild); $arXML['children']=$t; return($arXML); } $xml = simplexml_load_file('http://ws.geonames.org/findNearbyPlaceName?lat=53.039316&lng=-2.22706'); echo '<pre>'; print_r(xml2array($xml)); echo '</pre>'; ?>
  15. Hi Mchl, I've had a play with that and it will spit out the below but how do I get countryName into a variable (I've not had a lot of experience with arrays) Cheers Simon
  16. Hi, I need to get some information from an XML feed into variables I can use in PHP eg: http://ws.geonames.org/findNearbyPlaceName?lat=50.36443&lng=-4.15639 outputs: How can extract <name> into $name and <countryName> into $countryname Cheers Simon
  17. I need to be able to get some data from a URL and then split it up and assign variables. Eg: http://www.xxx.com/api?action=getPositions&key=xxxxxxxxxxxxxxxxxxxxx shows: I need to be able to get that information and assign each item to a variable (there will only ever be one result). I think I need CURL for this maybe but don't really know where to start. Hope someone can help! Thanks Simon
  18. Thanks MrAdam - simple!
  19. ok you two - that's scary! Unforuntately, it's being checked by a third party piece of software that I need to put in a regexp Any ideas? Cheers
  20. Hi, I'm looking to use regex to ensure a field begins with http:// Can anyone tell me how I can do that? Thanks Simon
  21. Thanks guys - I went with the strtok which worked great. Simon
  22. Hi, I need to be able to split a domain name into two variables - the bit before the 'dot' and the bit after eg microsoft.com I need domain = microsoft tld = com (there will always be only one 'dot') What's the best way to do this? Thanks Simon
×
×
  • 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.