Jump to content

[SOLVED] Displaying multiple records


xeidor

Recommended Posts

I have a page with a bunch of info on it, what I want to do is have the user click check boxes next to the ones they want to see then submit it and only those selected items show up on the following page (results.php) . So I set up the check boxes and had the info submit via get. The problem is that the other page only shows 1 of the items the checked not all of them.

 

Heres the url that is sent after selecting the items they want to see

 

result.php?Submit=Submit&recordID=62&recordID=66&recordID=65

 

The results page only shows the last record (recordID=65), and ignores the previous 2.

 

The code I have on the results page is

 

<?php

$colname_Recordset1 = "1";

if (isset($_GET['recordID'])) {

  $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['recordID'] : addslashes($_GET['recordID']);

}

mysql_select_db($database_Crewlist, $Crewlist);

$query_Recordset1 = sprintf("SELECT * FROM flights WHERE id = '%s' ORDER BY Datea, ETA ASC", $colname_Recordset1);

$Recordset1 = mysql_query($query_Recordset1, $Crewlist) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

?>

 

Any ideas on how to get all three of the selected items to show up on the results page?

 

Any help would be appreicated thanks.

Link to comment
https://forums.phpfreaks.com/topic/41371-solved-displaying-multiple-records/
Share on other sites

You would need to catch them in an array, and then use a foreach loop to process each one of them and output your desired information.

 

Right nowthe recordID is simply overwritten until it gets to the last one, and that is the only recordID that your script is actually processing.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.