Posted by lzimon on February 26, 2009 at 3:37pm
Jump to:
| Project: | Views Custom Field |
| Version: | 5.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
Issue Summary
My PHP-Code is disappearing when i'm using an if-form with "else". For example:
$available = mysql_query("SELECT anzahl FROM belegung WHERE nid = $data->nid");
while ($row = mysql_fetch_object($available))
{
echo $row->anzahl;
};works but
$available = mysql_query("SELECT anzahl FROM belegung WHERE nid = $data->nid");
while ($row = mysql_fetch_object($available))
{
if (!is_null($row->anzahl))
{
echo $row->anzahl;
}
else
{
echo "Alle Plätze belegt";
}
}doesn't work anymore.
Is it a stupid fault in the syntax or a bug ? I tried my code on another form and it worked all fine, so i put this issue as a "bug report" as a precaution. Also there is no error message, it simply disappears from the form.
Comments
#1
See #346216: All code in long custom field is discarded
Sorry, but I won't update the D5 version because I don't use it on the moment and D6 isn't stable yet. patches are welcome though.
#2
Thanks for your reply.
the solution is
The PHP code is saved to the Options field of view_tablefield database table in the serialized manner.
The Options field is defined as varchar(255), this means that it has maximum length of 255 characters.
So, the problem is due to limitation of the length of database field, in which evaluated PHP code is stored.
So you have only to increase the length of your databasefield to make longer scripts work.
#3
D5 version is no longer supported (wasn't for a long time to be honest).