Buy Now
Sign in

split and list the string

samir1903 , January 11 at 14:56
S
samir1903 170
January 11 at 14:56 #382772
Hello everyone
checkboxes have
photoshop=photosohop
word=word
excel=excel
powerpoint=powerpoint
other=other
this is written with db save
courses:{data.join[, ]:courses}
and output is in example of
photoshop, word, excel, powerpoint
photosohp, excel, other
excel,other
word,excel
i want to know how many excel how many word and list
for example
word 10
excel 7
other 3
so i know word is the most popular program
how can i do this?
healyhatman 6.1
January 11 at 21:27 #382777
So you have that all stored in your database and you want a read data to tell you how many of each? According to a search that's actually quite difficult to do in MYSQL. You might have to use PHP to instead loop through the results and foreach($this->get('read_data#')) add 1 to each count if strpos !== false
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
S
samir1903 170
January 12 at 05:09 #382778
i am sorry but i a think i a bit confused about this do you mind to be little more clear on how to do it?
healyhatman 6.1
January 12 at 05:14 #382779
$word = 0;
$excel = 0;
$other = 0;
foreach($this->get("read_data#") as $entry) {
$word += (strpos("word", $entry["read_data_model_name"]["field_containing_the_csv_list"]) === true ? 1 : 0);
etc etc
return array("word" => $word, "excel" => $excel, "other" => $other);
Then use {var:php_block_name.word} or {var:php_block_name.excel} etc etc
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
healyhatman 6.1
January 12 at 06:36 #382780
Also never copy+paste from the forums, it adds hidden format characters that will break your code.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums