0
<?php
$query = mysql_query("select * from `tbl_student`");
while($data = mysql_fetch_array($query))
{
        $output[] = array ($data[0],$data[1],$data[2],$data[3],
            '<select class="form-control select1" id="'.$data[0].'">
            <option 'if(----){'selected'}'>asd</option>
            <option >dasd</option>
            <option>asd</option>
            </select>');
}
echo json_encode($output);
?>

<!--here code of if() throw error-->

2
Contributors
5
Replies
12
Views
2 Years
Discussion Span
Last Post by Vivek_13
1

Invalid syntax. What do you want to happen?

<option ' . ($a == $b ? 'selected' : '') . '>asd</option>

Edited by pritaeas

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.