goldenbrown21 Posted March 22, 2008 Share Posted March 22, 2008 Hi All, I'm having a problem with trying to display multiple results from two databases. Basically, it's a table that is displaying results about customer accounts. One database has the customers details, and the other database contains customer call history. I've currently got the table to display the customer's details, but it only displays one record (the earliest in the database) of the customer's call history. As these are coming from two databases, repeat region doesn't help with me with the second database. My code is as follows... <?php require_once('Connections/conNSC.php'); ?> <?php $colname_rsCollation1 = "s2960"; if (isset($_GET['TDR'])) { $colname_rsCollation1 = (get_magic_quotes_gpc()) ? $_GET['TDR'] : addslashes($_GET['TDR']); } mysql_select_db($database_conNSC, $conNSC); $query_rsCollation1 = sprintf("SELECT customerdetails.custcode, customerdetails.custname, customerdetails.Email, customerdetails.Telephone, customerdetails.`Business Type`, customerdetails.`Product Focus`, customerdetails.OEM, customerdetails.System, customerdetails.Peripherals, customerdetails.Consumables, customerdetails.Telecommunications, customerdetails.Other, customerdetails.TDR, callout.date, callout.callout FROM customerdetails, callout WHERE TDR = '%s' AND callout.custcode = customerdetails.custcode ORDER BY customerdetails.custcode ASC", $colname_rsCollation1); $rsCollation1 = mysql_query($query_rsCollation1, $conNSC) or die(mysql_error()); $row_rsCollation1 = mysql_fetch_assoc($rsCollation1); $totalRows_rsCollation1 = mysql_num_rows($rsCollation1); $currentPage = $_SERVER["PHP_SELF"]; $queryString_rsSearchResults = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_rsSearchResults") == false && stristr($param, "totalRows_rsSearchResults") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_rsSearchResults = "&" . htmlentities(implode("&", $newParams)); } } $queryString_rsSearchResults = sprintf("&totalRows_rsSearchResults=%d%s", $totalRows_rsSearchResults, $queryString_rsSearchResults); ?> .... <?php do { ?> <tr> <td><?php echo $row_rsCollation1['custcode']; ?></td> <td><?php echo $row_rsCollation1['custname']; ?></td> <td><?php echo $row_rsCollation1['TDR']; ?></td> <td><?php echo $row_rsCollation1['Telephone']; ?></td> <td><?php echo $row_rsCollation1['Email']; ?></td> <td> </td> <td><?php echo $row_rsCollation1['Product Focus']; ?></td> <th scope="col"><?php echo $row_rsCollation1['Business Type']; ?></th> [font=Verdana] <th scope="col"><?php echo $row_rsCollation1['date']; ?> //I need the date and notes to display all of the call history// <th scope="col"><?php echo $row_rsCollation1['callout']; ?></th>[/font] <th scope="col"> </th> <th scope="col"> </th> <th scope="col"> </th> <th scope="col"> </th> </tr> <?php } while ($row_rsCollation1 = mysql_fetch_assoc($rsCollation1)); ?> </table> </form> </body> </html> <?php mysql_free_result($rsCollation1); ?> I've searched the forum but haven't found anything that assists me with my issue. Any help or advice would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/97315-help-required-displaying-multiple-results-from-multiple-databases/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.