Page 1 of 1

echoing a query string

Posted: Tue Feb 24, 2004 6:18 pm
by tatlar
Hi there,

I am connecting to a database to return a series of records as described by a certain DB processing function. The records are returned as a list, and I am then selecting one or more of these records and submitting the form again to a new page. What I want is the DB query string (not the results of the query) to be passed to the new page as well so I know what the query string was.

Here is the code I have (all custom functions I have written):

MAIN.PHP

Code: Select all

$dbname = "test_database" ; 
$tablename = "records" ; 
$db = dbopen( $dbname, $tablename ) ; 
$db = dblookup( $db ) ;
Okay, so this returns a list of records (via a foreach loop) with a form checkbox next to the value itself:

Code: Select all

echo "<tr>\n"; 
echo "\t<td nowrap><input name="records[]" type="checkbox" id="records" value="records[$db[3]]"</td>\n"; 
echo "\t<td nowrap>$db[3]</td>\n"; 
echo "</tr>\n";
Now. when I submit THIS FORM the variables are sent to a new page. What I want is to return the QUERY STRING $db, NOT its resulting array, so I can pass the query to another function, called for example, do_something_interesting():

Code: Select all

function do_something_interesting( "$db", "$records" ) ;

So, if I could print out the function I would get:

Code: Select all

do_something_interesting( "dblookup( dbopen( test_database, records ) )" , "1" ) ;

The dblookup( dbopen( test_database, records ) ) is the information I want.

Does anyone know how I can return JUST the query string itself - not the results it gives as an array.

I can clarify if this question is not too clear.

Thanks in advance.

Posted: Wed Feb 25, 2004 11:01 am
by tatlar
Any ideas for this problem?

Posted: Wed Feb 25, 2004 11:12 am
by JayBird
just store your QUERY as a string and then echo it. Easy Peasy.

Cant give you an example without seeing all your code.

Mark

Posted: Wed Feb 25, 2004 11:17 am
by tatlar
It echoes as an array, with the result of the query. It does not just echo out the string itself