Welcome Guest, Not a member yet? Register   Sign In
View/Edit view file
#4

[eluser]Samuurai[/eluser]
I'm having some issues with this approach... my code is currently like this:
Code:
foreach($result as $row)
echo "<h1>Foo is </h1>";
{
    if(isset($new)) {
        echo '&lt;input type="text" name="foo"&gt;';
    }
    elseif(isset($edit)) {
        echo '&lt;input type="text" name="foo" value="$row[foo]"&gt;';
    }
    else {
        echo $row->foo;
    }
}
This code is deeply flawed! If I want to add a new record, no queries will be performed so $result will not be set, so it errors.

How should I be doing this?


Messages In This Thread
View/Edit view file - by El Forum - 08-04-2009, 09:54 AM
View/Edit view file - by El Forum - 08-04-2009, 11:00 AM
View/Edit view file - by El Forum - 08-04-2009, 01:25 PM
View/Edit view file - by El Forum - 08-10-2009, 11:03 AM
View/Edit view file - by El Forum - 08-10-2009, 01:31 PM
View/Edit view file - by El Forum - 08-11-2009, 03:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB