Welcome Guest, Not a member yet? Register   Sign In
Parse Error
#1

[eluser]Markie577[/eluser]
Hi People!

Wondering if someone could help with a problem I can't get my head around!

I want output a select field which gets its data from a database

this is the code
Code:
$options = '<select name="cities" id="cities">';
            foreach($data->result() as $row)
            {
            $options .= '<option value='$row->sort_id'>'$row->name_city;'</option>';
            }
            $options .= "</select>";
            
            echo $options; // this will be received by your jQuery script

The option variable within the foreach loop is the one that gives me trouble!
I get a Parse error
Parse error: syntax error, unexpected T_VARIABLE with that option field!

If I would delete that option variable and echo $row->name_city it will work!

anyone know what this can be?

Sincere thanks


Messages In This Thread
Parse Error - by El Forum - 06-07-2010, 05:28 AM
Parse Error - by El Forum - 06-07-2010, 05:31 AM
Parse Error - by El Forum - 06-07-2010, 05:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB