|
Posted by Ian Davies on 10/08/05 19:37
Thanks for all the feedback
However I am still confused. Let me
In QUESTION.PHP I have records displayed from a MySQL database table in an
HTML table and a check box for each record as follows
*************************************************************
<input type="checkbox" name="checkbox[]" value="<? echo
$QuestionNo?>"
*****************************************************************
I also have a form and a button as follows, which is suposed to run
FILTER.PHP
**********************************************************
<form name="form1" method=post action="Filter.php">
<input type="submit" name="Submit" value="Submit">
*************************************************************
I am unsure of the script to use in the SQL of FILTER.PHP to filter records
based on the ticked checkboxs
FILTER.PHP has the following SQL (which is obviously wrong). Basically I am
not sure how to use the array from QUESTION.PHP to filter records in
FILTER.PHP
******************************************************
<?php
$filtered = @mysql_query("SELECT * FROM Questions WHERE QuestionNo IN ( " .
join(",", $_REQUEST['$QUESTION_NOS_FROM_THE_ARRAY']) . " )";
if (!$filtered) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
$filteredrow = mysql_fetch_assoc($filtered);
extract($filteredrow);
// Display the text of each Question in a paragraph
//while ($filteredrow = mysql_fetch_array($filtered)) {
// echo '<p>' . $filteredrow['QuestionNo'] . '</p>';
//}
?>
***********************************************
"JDS" <jeffrey@example.invalid> wrote in message
news:pan.2005.10.07.19.42.08.511056@example.invalid...
> On Fri, 07 Oct 2005 08:33:51 +0200, Dikkie Dik wrote:
>
> > an array of checked items on the server. You can use the implode
> > function to convert it to a comma separated list if you want to.
>
> Example[1]:
>
> $sql = "SELECT * FROM boogers WHERE booger_id IN ( "
> . join(",", $_REQUEST['booger_ids']) . " )";
>
> (Note that that is all one line of PHP).
>
> You can use implode() instead of join() -- they are functionally
identical.
>
>
> [1] Change "booger" to "bogie" for those from the UK. :)
> --
> JDS | jeffrey@example.invalid
> | http://www.newtnotes.com
> DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
>
[Back to original message]
|