Solved

execute a variable

Posted on 2003-11-05
3
217 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP: Insert Data into MySQL 5 39
curl SSL certificate unable to get local issuer certificate 15 64
PHP populating an array. 4 23
php extract($_REQUEST) 5 46
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…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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.

776 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