Solved

execute a variable

Posted on 2003-11-05
3
220 Views
Last Modified: 2008-03-06
Hello every one I was wondering if someone could tell me how to execute a variable.

here is my variable

   $variable = "$sql = \"SELECT sql1
                                    FROM chgacct.request_$_GET[response_code]\";

                     $statement = OCIParse ($connection, $sql);
                     OCIExecute ($statement);

                     while (OCIFetchInto ($statement, $row, OCI_ASSOC)) {
                     $sql1 = $row['SQL1'];  
                     $display_block .= \"<tr><td>$site_no</td></tr>\"
                     }";

I would like to set $variable to this long string which will query a database and save the query results in $display_block.  

I did an echo $variable and it is the exact code needed to query but no results will post to the screen.

I tried to execute the varible like so

<?php

  $connection = ('xxxxx', 'xxxxx', 'xxxxxx');

   $variable = "$sql = \"SELECT sql1
                                    FROM chgacct.request_$_GET[response_code]\";

                     $statement = OCIParse ($connection, $sql);
                     OCIExecute ($statement);

                     while (OCIFetchInto ($statement, $row, OCI_ASSOC)) {
                     $sql1 = $row['SQL1'];  
                     $display_block .= \"<tr><td>$site_no</td></tr>\"
                     }";

?>

<html>
<body>
<? echo "$display_block"; ?>
</body>

the results to not show up on the screen

Does that make sense?
0
Comment
Question by:jmsloan
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
aolXFT earned 50 total points
ID: 9688938
eval($variable)
0
 
LVL 3

Author Comment

by:jmsloan
ID: 9688968
that didn't take long

thanks
0
 
LVL 6

Expert Comment

by:aolXFT
ID: 9688990
> that didn't take long

We aim to please...!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question