Displaying 131-140 of 274 results.
Resolved: How to get the latest record in each group using GROUP BY?
posted by admin on May 21, 2016
Let's say I have a table called messages with the columns:

id | from_id | to_id | subject | message | timestamp


I want to get the latest message from each user only, like you would see in your FaceBook inbox before you drill down into the actual thread.

This query seems to get me close to the result I need:

SELECT * FROM messages GROUP BY from_id


However the query is giving me the oldest message from each user and not the newest.

I can't figure this one out.Read more
Resolved: Get data from table from a list of strings on MySQL
posted by admin on May 6, 2016
How can I query data from a table available on a list of strings?

I only want to get the data from the list of strings.

Example:
Table
ID Name
1 Big
2 Small
3 Extra
4 Orange
5 Drink



List of Strings:
Big
Small
Extra
Read more
Resolved: Remove the last character(comma) from string
posted by admin on May 6, 2016
I have a string like

a,b,c,d,e,


I would like to remove last ',' and get the remaining string back

OUTPUT: a,b,c,d,e
Read more
Resolved: MySQL IN for all values
posted by admin on May 6, 2016
I have MySQL query, which contain IN clause

select ItemID
from ItemCategory
where CategoryID in (5,6,7,8)
group by ItemID


I need it to work like an AND across multiple rows.Read more
Resolved: PHP display an Array under alphabetical letters without key sensitive
posted by admin on April 27, 2016
I have an associative array of tags like

array(11) {
[0]=>
array(4) {
["tag_id"]=>
string(2) "81"
["slug"]=>
string(4) "mag1"
["name"]=>
string(4) "mag1"
["TagsCount"]=>
string(1) "2"
}
[1]=>
array(4) {
["tag_id"]=>
string(2) "85"
["slug"]=>
string(4) "mag2"
["name"]=>
string(4) "mag2"
["TagsCount"]=>
string(1) "1"
}
[2]=>
array(4) {
["tag_id"]=>
string(2) "83"
["slug"]=>
string(4) "mag3"
["name"]=>
string(4) "mag3"
["TagsCount"]=>
string(1) "2"
}
[3]=>
array(4) {
["tag_id"]=>
string(2) "84"
["slug"]=>
string(4) "mag4"
["name"]=>
string(4) "mag4"
["TagsCount"]=>
string(1) "2"
}
. . .
[9]=>
array(4) {
["tag_id"]=>
string(2) "79"
["slug"]=>
string(4) "tag5"
["name"]=>
string(4) "tag5"
["TagsCount"]=>
string(1) "1"
}
[10]=>
array(4) {
["tag_id"]=>
string(2) "80"
["slug"]=>
string(4) "tag6"
["name"]=>
string(4) "tag6"
["TagsCount"]=>
string(1) "1"
}
}

In output I want to see result like

<h3>A</h3>
<ol>
<li>
<em>tag count</em>
<a href="link to tag">Animal</a>
</li>
<li>
<em>tag count</em>
<a href="link to tag">Aqua</a>
</li>
<li>
<em>tag count</em>
<a href="link to tag">Arthur</a>
</li>
</ol>
<!-- if B not EXIST not show B -->
<h3>C</h3>
<ol>
<li>
<em>tag count</em>
<a href="link to tag">Camel</a>
</li>
<li>
<em>tag count</em>
<a href="link to tag">Crazy</a>
</li>
</ol>
<!-- etc -->
Read more
Resolved: Submit form on change of dropdown list
posted by admin on April 26, 2016
I have SELECT dropdown list

<form method="GET" >
<select id="id_period" name="period">
<option value="day">day</option>
<option value="week">week</option>
<option value="month">month</option>
<option value="all" selected="selected">all time</option>
</select>
</form>

I want to submit form on changeRead more
Resolved: jQuery UI auto close dialog don't show ever, show one time
posted by admin on April 26, 2016
I have dialog box

$( "#dialog" ).dialog({
autoOpen: false,
show: {
effect: "blind",
duration: 500
},
hide: {
effect: "blind",
duration: 500
},
});


USAGE:

$('.add-block-without-media').click(function (){
$( "#dialog" ).dialog( "open" );
})


I want to autoclose dialog and see dialog one time.Read more
Resolved: Yii CGridView buttons url target _blank not working
posted by admin on April 25, 2016
I try to target _blank my CGridView buttons

<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'media-grid',
'dataProvider'=>$media->searchadmin(),
'filter'=>$media,
'columns'=>array(
'id',
. . .
array(
'class'=>'CButtonColumn',
'template'=>'{view}{update}',
'buttons'=>array
(
'update' => array(
'url'=>'CController::createUrl("/media/update/id/{$data->primaryKey}")',
'target'=>'_blank',
),
'view' => array(
'url'=>'CController::createUrl("/media/view/id/{$data->primaryKey}")',
'target'=>'_blank',
),
),
),

),
)); ?>
Read more
Resolved: Yii get current controller and action
posted by admin on April 25, 2016
Is their a way to get the name of the current controller and action that the app is executing? I was wondering if Yii:app stores this or not, but I can't find any reference to it. I need this information to use in the main layout view for a widget.Read more
Resolved: jQuery check if an HTML element is empty using
posted by admin on April 25, 2016
I'm trying to call a function only if an HTML element is empty, using jQuery.

Something like this:

if (isEmpty($('#element'))) {
// do something
}
Read more