?
Solved

execute a variable

Posted on 2003-11-05
3
Medium Priority
?
235 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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.
Suggested Courses

649 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