Jump to content

ruraldev

Members
  • Posts

    41
  • Joined

  • Last visited

About ruraldev

  • Birthday 03/14/1968

Contact Methods

  • Website URL
    http://www.ruraldevtrust.co.uk

Profile Information

  • Gender
    Male
  • Location
    Scotland, UK

ruraldev's Achievements

Member

Member (2/5)

0

Reputation

  1. I got it, turned out I was changing the value of a variable earlier in the code as I was outputting the variable for testing Simple but rather silly mistake!
  2. The nest line was closing the </select> I tried the new format but still nothing appears in the dropdown list? Weird?
  3. I have the following code which works (thanks to PHP Freaks members) foreach ($swap["sims"] as $swap) { echo $swap['voice'] . "</br>"; } But I can't figure out why the following doesn't work <select name="sim_for_swap[]"> <?php foreach ($swap["sims"] as $swap) { ?> <option value="<?php echo $swap['voice'];?>"><?php echo $swap['voice'];?></option> <?php } ?>
  4. Thanks to both, now it works perfectly and I understand more about what each part does.
  5. Thank you for not only taking the time to give me the correct code but also to provide some workings which I can use to understand the process. It returns the values I want but for some reason I get an error at the bottom of the page: Warning: Invalid argument supplied for foreach() in ....... For line: foreach ($stock["sims"] as $sim) Any ideas? foreach ($stock["stock"] as $stock) { foreach ($stock["sims"] as $sim) { echo $sim . "</br>"; } }
  6. I am trying in vain to access the numbers in the "sims" array using the code below, I have tried various numbers of nested foreach loops but get errors every time, can anyone help point me in the correct direction please. Thanks Gordon $stock = (array(1) { ["stock"]=> array(2) { [0]=> array(2) { ["operator"]=> string(3) "ECL" ["sims"]=> array(51) { [0]=> int(8944122650438410000) [1]=> int(8944122650438409000) [2]=> int(8944122650438409000) } } [1]=> array(2) { ["operator"]=> string(2) "JT" ["sims"]=> NULL } } } ) foreach ($stock as $key1 => $item1) { foreach($item1 as $key2 => $item2) { foreach($item2 as $key => $value) { echo $value[sims] . "</br>"; } } }
  7. Thanks for the help, I suppose that's what happens when I take bits of code from various samples! I have run the query manually to make sure it returns the 8 rows of data and it does work. I'll try outputting text instead of sending emails to see what happens. Cheers Gordon
  8. Can anyone help me with why this code would only send 1 email when the query returns 8 rows? I am pretty sure it will be simple but I can't find the problem! $sql = "SELECT email, supplier_id FROM tbl_suppliers"; $stmt = $db->prepare($sql); $stmt->execute(); foreach($db->query($sql) as $row){ $supp_id = $row['supplier_id']; $emailCSV->setEmailMessage("some generic text message"); $email = $row['email']; $emailCSV->sendEmail("me@me.com",$email,"Quote Request"); }
  9. Managed to get it almost perfect, code below in case it helps anyone else. $ras = stream_socket_client($svr_add,$errno,$errstr,$svr_timeout); fputs ($ras, $xml_data); stream_set_timeout($ras, 1); $ras1 = stream_get_contents($ras, -1); It takes 1 second but that's not a problem, I'll probably play with it to get the perfect timeout value. Thanks for the help Gordon
  10. I should have just given the code $ras = fsockopen($svr_add,$svr_port,$errno,$errstr,$svr_timeout); fputs ($ras, $xml_data); $ras1 = stream_get_contents($ras, -1, -1); fclose($ras); $startpos = strpos($ras1,'<',0); $xml = substr($ras1,$startpos); echo print_r($xml);
  11. I use fsockopen to make the connection and then send an xml command using fputs which makes the server return an xml string, the returned xml string varies in length.
  12. I am using stream_get_contents and if I specify a length which is less than the stream length it returns the page quickly, if I use -1 or a value higher than the stream length it takes more than a minute! Very slow versions stream_get_contents($ras, 8000, -1); stream_get_contents($ras, -1, -1); Very quick stream_get_contents($ras, 7500, -1); The stream length varies so I don't have any idea what value will speed it up! Any solutions?
  13. Thanks, I used a combination of strpos() and substr() and it works perfectly It's very slow but that'll be a different issue! Regards Gordon
  14. It is not something I control, as soon as the connection happens the string is returned. I'll try the fix you suggest later and hopefully that will solve it for me. Thanks for your help Gordon
  15. The connection string is almost exactly the same each time but there is a couple of characters different. eg. ?U??
×
×
  • 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.