[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

execute a variable

Posted on 2003-11-05
3
Medium Priority
?
241 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 200 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses
Course of the Month19 days, 13 hours left to enroll

872 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