cmaclennan Posted May 15, 2009 Share Posted May 15, 2009 I have a form the submits data to multiple tables and im now trying to create just a simple page that pulls all of the data corresponding to an ID so that It can be printed out. can anyone give me a hand with this? or a starting point? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/158313-need-helptrying-to-simply-display-data-from-2-tables-to-print-out/ Share on other sites More sharing options...
Maq Posted May 15, 2009 Share Posted May 15, 2009 I have a form the submits data to multiple tables and im now trying to create just a simple page that pulls all of the data corresponding to an ID so that It can be printed out. can anyone give me a hand with this? or a starting point? Thanks Is this a question regarding MySQL? So you want data from 2 different tables that match against an ID? You're going to need a JOIN. Quote Link to comment https://forums.phpfreaks.com/topic/158313-need-helptrying-to-simply-display-data-from-2-tables-to-print-out/#findComment-834957 Share on other sites More sharing options...
cmaclennan Posted May 15, 2009 Author Share Posted May 15, 2009 It's not so much a question about MySQL as much as im completely having one of those days where i can rememeber anything, all the data is in the tables just fine and I have a page that displays a list of entries and I want to be able to hit a button and have a new page open with all the associated data layed out that i can print it. I tried editing a page i had used to edit data but that didnt work at all and i have no idea where to begin when it comes to joins. Quote Link to comment https://forums.phpfreaks.com/topic/158313-need-helptrying-to-simply-display-data-from-2-tables-to-print-out/#findComment-834962 Share on other sites More sharing options...
Maq Posted May 15, 2009 Share Posted May 15, 2009 all the data is in the tables just fine and I have a page that displays a list of entries and I want to be able to hit a button How are these chosen? Do you have this part done? Does it submit? Can we see the processing page? have a new page open with all the associated data layed out that i can print it Associated how? By the id? Quote Link to comment https://forums.phpfreaks.com/topic/158313-need-helptrying-to-simply-display-data-from-2-tables-to-print-out/#findComment-834966 Share on other sites More sharing options...
cmaclennan Posted May 15, 2009 Author Share Posted May 15, 2009 Once the data is submitted a few fields are viewable on a page with links to edit, delete and print below is the code of how the main id is passed to the pages, and this is how i would have the print button open a new page with the corresponding info. // Make the query. $query = "SELECT rma_id, date, store_company, ticket, phone, ext FROM returns ORDER BY $order_by LIMIT $start, $display"; $result = @mysql_query ($query); // Run the query. // Table header. echo '<table align="center" cellspacing="0" cellpadding="2" width="750px"> <tr> <td align="left"><b>Edit</b></td> <td align="left"><b>Delete</b></td> <td align="left"><b>Print</b></td> <td align="left"><b>Date</b></td> <td align="left"><b>RMA ID</b></td> <td align="left"><b>Store/Company</b></td> <td align="left"><b>Ticket Number</b></td> <td align="left"><b>Phone</b></td> <td align="left"><b>Ext</b></td> </tr> '; // Fetch and print all the records. $bg = '#eeeeee'; // Set the background color. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee'); // Switch the background color. echo '<tr bgcolor="' . $bg . '"> <td align="left"><a href="rma_edit.php?id=' . $row['rma_id'] . '">Edit</a></td> <td align="left"><a href="rma_delete.php?id=' . $row['rma_id'] . '">Delete</a></td> <td align="left"><a href="rma_print.php?id=' . $row['rma_id'] . '">Print</a></td> <td align="left">' . $row['date'] . '</td> <td align="left">' . $row['rma_id'] . '</td> <td align="left">' . $row['store_company'] . '</td> <td align="left">' . $row['ticket'] . '</td> <td align="left">' . $row['phone'] . '</td> <td align="left">' . $row['ext'] . '</td> </tr> '; } Quote Link to comment https://forums.phpfreaks.com/topic/158313-need-helptrying-to-simply-display-data-from-2-tables-to-print-out/#findComment-834970 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.