Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a value from a database that I want to place into a javascript array but I am not able to see it in the output.

var sales = [{
        label: 'Delivered',
        data: [[1, 0],[2,0],[3,0],[4,0],[5,0],[6,0],[7,echo **<?php $row['totaldeliveredsms'];?>**],[8,0],[9,0],[10,0],[11,0],[12,0]]
    },{
        label: 'Pending',
        data: [[1, 0],[2,0],[3,0],[4,0],[5,0],[6,0],[7,echo **<?php $row['totaldeliveredsms'];?>**],[8,0],[9,0],[10,0],[11,0],[12,0]]
    },{
        label: 'Undelivered',
        data: [[1, 0],[2,0],[3,0],[4,0],[5,0],[6,0],[7,echo **<?php $row['totaldeliveredsms'];?>**],[8,0],[9,0],[10,0],[11,0],[12,0]]
    }
    ];

Why are the values not shown in the output?

share|improve this question
4  
You're missing echo... –  Florent Oct 18 '12 at 13:35
2  
echo **<?php $row['totaldeliveredsms'];?>** certainly looks suspicious... –  Wesley Murch Oct 18 '12 at 13:37
    
echo **<?php $row FAIL –  ajtrichards_wales Oct 18 '12 at 13:40
1  
i think he was trying to bold the <?php using the stackoverflow ** tag... Wouldn't make any sense else. –  Pilatus Oct 18 '12 at 13:41
    
Yes Pilatus true i was trying to make it bold.. –  Farangi Saqib Oct 19 '12 at 12:38
show 1 more comment

closed as too localized by Wesley Murch, zzzzBov, Pondlife, RichardTheKiwi, Piotr Gwiazda Oct 18 '12 at 16:31

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

I think you will get more output if you place the echo within the PHP tag.

var sales = [{
    label: 'Delivered',
    data: [[1, 0],[2,0],[3,0],[4,0],[5,0],[6,0],[7,<?php echo $row['totaldeliveredsms'];?>],[8,0],[9,0],[10,0],[11,0],[12,0]]
},{
    label: 'Pending',
    data: [[1, 0],[2,0],[3,0],[4,0],[5,0],[6,0],[7,<?php echo $row['totaldeliveredsms'];?>],[8,0],[9,0],[10,0],[11,0],[12,0]]
},{
    label: 'Undelivered',
    data: [[1, 0],[2,0],[3,0],[4,0],[5,0],[6,0],[7,<?php echo $row['totaldeliveredsms'];?>],[8,0],[9,0],[10,0],[11,0],[12,0]]
}];
share|improve this answer
    
Oh yes thanks i already placed it within just copy mistake. but still didnt get any result. Any feedback plz. –  Farangi Saqib Oct 19 '12 at 12:37
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.