Jump to content

Need Help...Trying to simply display data from 2 tables to print out.


cmaclennan

Recommended Posts

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

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.

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.

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?

 

 

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>
';
}

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.