echoing a query string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
tatlar
Forum Newbie
Posts: 7
Joined: Tue Feb 24, 2004 6:18 pm
Location: Surfside

echoing a query string

Post 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.
User avatar
tatlar
Forum Newbie
Posts: 7
Joined: Tue Feb 24, 2004 6:18 pm
Location: Surfside

Post by tatlar »

Any ideas for this problem?
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post 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
User avatar
tatlar
Forum Newbie
Posts: 7
Joined: Tue Feb 24, 2004 6:18 pm
Location: Surfside

Post by tatlar »

It echoes as an array, with the result of the query. It does not just echo out the string itself
Post Reply