Search found 12 matches

by dareskog
Sat Feb 02, 2013 8:56 pm
Forum: PHP
Topic: Sorting Mysql List
Replies: 1
Views: 920

Sorting Mysql List

Ive got a mysql table with a load of clients listed. The below script echos out each of them perfectly except I would like them to be sorted alphabetically. How can I do this with what I already have? $client_list = mysql_query("SELECT * FROM clients"); while($row = mysql_fetch_array($clie...
by dareskog
Tue Nov 27, 2012 7:14 pm
Forum: PHP
Topic: Sorting an array by a key
Replies: 2
Views: 832

Sorting an array by a key

I have an array with several entries.

A common key inside is "date_timestamp"

Lets pretend this array is called $items

How do i organise the elements inside $items by the common key "date_timestamp" which is a unix time stamp?
by dareskog
Tue Nov 13, 2012 8:19 pm
Forum: PHP
Topic: PHP Ping
Replies: 4
Views: 1108

Re: PHP Ping

i was just using xammp on my pc for now, how do i enable this on there?
by dareskog
Mon Nov 12, 2012 6:57 pm
Forum: PHP
Topic: PHP Ping
Replies: 4
Views: 1108

PHP Ping

I stumbled across this code and tried running it but it always seems to return "down" or "off" - Can anyone see whats wrong? <?php function ping($host) { exec(sprintf('ping -c 1 -W 5 %s', escapeshellarg($host)), $res, $rval); return $rval === 0; } $hosts_to_ping = array('RANDOM_I...
by dareskog
Sat Jul 14, 2012 7:08 pm
Forum: PHP
Topic: Register and Login (User Account System) - Error
Replies: 2
Views: 689

Register and Login (User Account System) - Error

Hi, I've just gone through the php tutorial on the above stated but keep getting this error: "Strict Standards: Only variables should be passed by reference" this then points to the line on the init.inc.php which reads: $page = substr(end(explode('/', $_SERVER['SCRIPT_NAME'])), 0, -4); Is ...
by dareskog
Mon May 07, 2012 1:31 pm
Forum: PHP
Topic: Extracting a key variable from an array within an array :S
Replies: 2
Views: 571

Re: Extracting a key variable from an array within an array

My bad...
I had placed " " around the variables within the $user_selection array

Solved!
by dareskog
Mon May 07, 2012 12:55 pm
Forum: PHP
Topic: Extracting a key variable from an array within an array :S
Replies: 2
Views: 571

Extracting a key variable from an array within an array :S

I need the output of this to be: This is another This is awesome <?php $variable_one = array ("one"=>"This is one", "two"=>"This is another"); $variable_two = array ("one"=>"This is two", "two"=>"This is working lol"); $...
by dareskog
Sun Feb 05, 2012 11:34 pm
Forum: PHP
Topic: extracting info within an array from a checkbox selection
Replies: 4
Views: 759

Re: extracting info within an array from a checkbox selectio

Okay, I had a read over what you sent when I had some time, but don't really get it. Let me try and explain what i need it to do. So you've got these arrays predefined at the top of the document. There could be loads of them but they all contain the same 3 keys but the data attached to all these key...
by dareskog
Sat Feb 04, 2012 11:04 am
Forum: PHP
Topic: extracting info within an array from a checkbox selection
Replies: 4
Views: 759

Re: extracting info within an array from a checkbox selectio

Cheers Jacek! I'll give this ago! =]
by dareskog
Mon Jan 30, 2012 7:53 pm
Forum: PHP
Topic: extracting info within an array from a checkbox selection
Replies: 4
Views: 759

extracting info within an array from a checkbox selection

I've got what I want to achieve in my head, but I don't yet think in the way of PHP so I'm having trouble getting it to work in practise. So I've got (for examples sake) 2 predefined arrays, something like this. $arrayone = array("pizza" => "random unique stuff", "egg" ...
by dareskog
Tue Jan 24, 2012 11:47 pm
Forum: PHP
Topic: RSS displaying multiple feeds in time/date published order
Replies: 3
Views: 668

Re: RSS displaying multiple feeds in time/date published ord

Ah cheers! I was able to work out a sorting method using the link you provided, took me a while to get it tho! I've just got one last question which I'm struggling with. ATM, I've got this: $num_items = 8; $urls = array( "http://www.url1.com", "http://www.url2.com", "http://...
by dareskog
Sat Jan 21, 2012 2:55 am
Forum: PHP
Topic: RSS displaying multiple feeds in time/date published order
Replies: 3
Views: 668

RSS displaying multiple feeds in time/date published order

I'm trying to create a php rss parser that takes on multiple feeds, takes 10 entries from each, these all then get mixed together in an array and displayed in date order. Atm i've got this: <?php require_once 'magpierss/rss_fetch.inc'; $num_items = 10; $urls = array( "http://url1.com", &qu...