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
$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:
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():
function do_something_interesting( "$db", "$records" ) ;
So, if I could print out the function I would get:
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.if you are trying to make a query string form a bucnh of drop downs then it is best to put them together on the next page.
actually if I undertand, just put the query in a varaible and send that. phpmyadmin sends it in the url so why can't you.but if I send the query string as a variable in the form I get the *result* of the query, not the string itself.
is there a function to convert the string so I can just echo it out?
i tried serialize() but that didn't seem to help.
thx.not if you do this
$query = "select whatever from table";
mysql_query($query);
input type="hidden" value="$query">
it will send the text, not the results.indeed you are correct, when using MySQL. however, I am using a funky earthquake database that I have alluded to in another post:
<!-- m --><a class="postlink" href="http://www.htmlforums.com/showthread.php?s=&threadid=34740">http://www.htmlforums.com/showthread.ph ... adid=34740</a><!-- m -->
this does not allow me to define a nice simple command which I can store as a variable
thanks anyway...how are you using Datascope in php?
and if you are making a webapp that anybody can use then why such an oddball db?Originally posted by scoutt
how are you using Datascope in php?
and if you are making a webapp that anybody can use then why such an oddball db?
The key here is that it is a REALTIME database, it is not static, it is constantly updated with new data every millisecond, 24-7, 365.
Datascope has an interface to Perl, and I am helping build a web interface to Datascope using PHP. In the earthquake community it is not an "oddball" db, it is the equivalent of MSSQL or Oracle, its just that noone outside the earthquake community has heard of it....
I can send you some code if you want, to see how I have made the interface so far, but I would rather not post it here for all eyes to see
Thanks for the replies...sure pm me if you want.Thanks again Scoutt. Just thought I would publicly acknowledge your great and timely help via pm...
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
$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:
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():
function do_something_interesting( "$db", "$records" ) ;
So, if I could print out the function I would get:
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.if you are trying to make a query string form a bucnh of drop downs then it is best to put them together on the next page.
actually if I undertand, just put the query in a varaible and send that. phpmyadmin sends it in the url so why can't you.but if I send the query string as a variable in the form I get the *result* of the query, not the string itself.
is there a function to convert the string so I can just echo it out?
i tried serialize() but that didn't seem to help.
thx.not if you do this
$query = "select whatever from table";
mysql_query($query);
input type="hidden" value="$query">
it will send the text, not the results.indeed you are correct, when using MySQL. however, I am using a funky earthquake database that I have alluded to in another post:
<!-- m --><a class="postlink" href="http://www.htmlforums.com/showthread.php?s=&threadid=34740">http://www.htmlforums.com/showthread.ph ... adid=34740</a><!-- m -->
this does not allow me to define a nice simple command which I can store as a variable
thanks anyway...how are you using Datascope in php?
and if you are making a webapp that anybody can use then why such an oddball db?Originally posted by scoutt
how are you using Datascope in php?
and if you are making a webapp that anybody can use then why such an oddball db?
The key here is that it is a REALTIME database, it is not static, it is constantly updated with new data every millisecond, 24-7, 365.
Datascope has an interface to Perl, and I am helping build a web interface to Datascope using PHP. In the earthquake community it is not an "oddball" db, it is the equivalent of MSSQL or Oracle, its just that noone outside the earthquake community has heard of it....
I can send you some code if you want, to see how I have made the interface so far, but I would rather not post it here for all eyes to see
Thanks for the replies...sure pm me if you want.Thanks again Scoutt. Just thought I would publicly acknowledge your great and timely help via pm...