Solved

execute a variable

Posted on 2003-11-05
3
212 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
Comment Utility
eval($variable)
0
 
LVL 3

Author Comment

by:jmsloan
Comment Utility
that didn't take long

thanks
0
 
LVL 6

Expert Comment

by:aolXFT
Comment Utility
> that didn't take long

We aim to please...!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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 count occurrences of each item in an array.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now