I am using grid type field for express engine channel and i want to show result based to row_id and it was working when i have entered row_ids but it is not working when row_id are not there.
for eg. I have created a channel named as 'XYZ' and having following channel fields there :
1) user_type : text
2) profile : grid
a) first_name : text
b) last_name : text
c) user_name : text
d) age : text
Now i want to show user listing for a entry and i am getting row_id for grid from custom query in code. i have used following code :
.............
//here we are getting row_ids from custom query as
// if condition here
<?php $rowsId="10|11|12"; ?>
// else condition (set $rowsId value as -1 in case when we are not getting row_id from custom query)
<?php $rowsId = "-1" ; ?>
..............
{exp:channel:entries channel="xyz" entry_id=1}
{profile row_id="<?php echo $rowsId; ?>"}
{profile:first_name}<br/>
{profile:last_name}<br/>
{profile:user_name}<br/>
{profile:age}<hr>
{/profile}
{/exp:channel:entries}
But the code
{profile row_id="<?php echo $rowsId; ?>"}
it is working in case of <?php $rowsId="10|11|12"; ?>
but it is not working in case of <?php $rowsId = "-1"; ?>
It should not give us result set in that case (should be empty) but It shows one row in result set and i have also tried '$rowsId' value as 0 instead of -1 but it is also not working.
Please help me what is missing/wrong here or give me a solution for the same.