Re: Evaluate PHP var in stored sql statement?
| From: | Maxim Maletsky | Date: | Fri, 24 Jan 2003 17:59:45 +0000 |
| Subject: | Re: Evaluate PHP var in stored sql statement? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133018@lists.php.net to get a copy of this message | ||
use eval()
www.php.net/eval
--
Maxim Maletsky
maxim@php.net
"CF High" <noah@newminddesign.com> wrote... :
> Hey all.
>
> I need to find out how to get PHP to evaluate a PHP variable stored in our
> MySql database.
>
> Currently the variable is being read as a string; i.e. select * from table
> where column = $myrow[0] -- instead of evaluating $myrow[0] as a variable.
>
>
> The SQL statement is retrieved in the first call to dbConnect (see code
> below)
>
>
>
> dbConnect("SELECT header_id, header, sql_query FROM cat_headers WHERE
> section_id = $_REQUEST[section_id] order by header");
>
> $set = $result; /* Give initial result set a unique name */
>
> while ($myrow = mysql_fetch_row($set)) {
>
> echo(Display the header title here);
>
>
> dbConnect($myrow[2]); /* $myrow[2] is the sql_query gotten
> from the first dbConnect() call */
>
> $set1 = $result; /* Give next result set a unique name */
>
> while ($myrow = mysql_fetch_row($set1)) {
>
> echo(Display category rows here);
>
> }
>
> }
>
> --
> Any leads/suggestions much appreciated..........
>
> --Noah
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>