Help using decorator plugin
Posted: Fri May 09, 2008 5:26 pm
Hi,
I have been using the decorator plugin for some time now without any issues with the exact code from the docs. Now though I am trying to do something slightly different and not having any luck. The only change I've made to the original code is that I need the mysql table name to be a variable instead of hard coded. For example:
When I try to do this I get an error of undefined variable $mydbtable. Is there anyway to pass this into the function from my script?
Thanks,
Joe
I have been using the decorator plugin for some time now without any issues with the exact code from the docs. Now though I am trying to do something slightly different and not having any luck. The only change I've made to the original code is that I need the mysql table name to be a variable instead of hard coded. For example:
Code: Select all
//Extend the replacements class
class Replacements extends Swift_Plugin_Decorator_Replacements {
function getReplacementsFor($address) {
$query = "select col1 as `{col1}`, col2 as `{col2}`, col3 as `{col3l}` from $mydbtable where lead_email = '" . mysql_real_escape_string($address) . "'";
$result5 = mysql_query($query);
if (mysql_num_rows($result5) > 0)
{
return mysql_fetch_assoc($result5);
}
}
}Thanks,
Joe