Hello,
Here is an interesting problem I'm facing.
I've created a function called make_query() whose purpose is to allow me to use one single syntax for INSERT, UPDATE and SELECT commands.
There are several options and one of them (the last one) makes it possible to use the variable $template so that all the records are diplayed with the proper layout. As you can see, the function replaces all the words enclosed in "][" with the proper values taken from the database.
$template = "
<b>]news_date[</b> ]news_title[<br>
]news_desc[<br>
<br>
";
make_query("select", "my_table", "news_title . news_desc . news_date", "ORDER BY news_date ASC", NULL, $template);
print($output);
The problem is that now, I'd like to apply a function to the variable $news_date for example.
$template being a string, I'm wondering how I could have the name of the function written within this string so that $news_date would be altered by the function after all the database values are found in the string.
The first thing I've tried was :
$template = "
<b>" . format_sqldate("]news_date[", 4) . "</b> ]news_title[<br>
]news_desc[<br>
<br>
";
... which could never work of course.
Any idea?
Thanks a lot to the ones who will respond !
Here is an interesting problem I'm facing.
I've created a function called make_query() whose purpose is to allow me to use one single syntax for INSERT, UPDATE and SELECT commands.
There are several options and one of them (the last one) makes it possible to use the variable $template so that all the records are diplayed with the proper layout. As you can see, the function replaces all the words enclosed in "][" with the proper values taken from the database.
$template = "
<b>]news_date[</b> ]news_title[<br>
]news_desc[<br>
<br>
";
make_query("select", "my_table", "news_title . news_desc . news_date", "ORDER BY news_date ASC", NULL, $template);
print($output);
The problem is that now, I'd like to apply a function to the variable $news_date for example.
$template being a string, I'm wondering how I could have the name of the function written within this string so that $news_date would be altered by the function after all the database values are found in the string.
The first thing I've tried was :
$template = "
<b>" . format_sqldate("]news_date[", 4) . "</b> ]news_title[<br>
]news_desc[<br>
<br>
";
... which could never work of course.
Any idea?
Thanks a lot to the ones who will respond !
