displaying related data from MySQL

From: Date: Mon, 20 Aug 2001 12:57:57 +0000
Subject: displaying related data from MySQL
Groups: php.db 
Request: Send a blank email to php-db+get-11549@lists.php.net to get a copy of this message
Hi all, This sounds to me like a common question but I haven't found quite what I want anywaher (maybe I've been looking in the wrong place). So apologies from a complete newbie. I have built a database with 6 tables. The Master table contains keys to the other 5 tables. I want to be able to display related data when I display search results. This is the code I've been using (trial and error) but although I get a row for each fount record, I get an error in every table cell. $result=mysql_query ("select * from MASTER,ACFTREF where MASTER.MFR_MDL_CODE=ACFTREF.CODE AND MASTER.N_NUMBER LIKE '$Serial%' AND MASTER.SERIAL_NUMBER LIKE '$Con%' ORDER BY MASTER.N_NUMBER" ); ?> <table width=100% tr valign=top> <td colwidth=15%>Serial <td colwidth=35% align=right>Maufacturer <td colwidth=35% align=left>Model <td colwidth=15%>Con </td></tr> <?php if ($row = mysql_fetch_array($result)) { do { print ("<TR valign=top><TD bgcolor=yellow>N"); print $row['MASTER.N_NUMBER']; print ("<td>"); print $row['ACFTREF.MFR_NAME']; print ("<td>"); print $row['ACFTREF.TYPE_ACFT']; print ("<td>"); print $row['MASTER.SERIAL_NUMBER']; print ("<p></TD></TR>"); } while ($row = mysql_fetch_array($result)) ; } else {print "Sorry, no results found!";} } ?> Just for info, the Master db holds 340,000+ records. MTIA George in Edinburgh _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com

« previous php.db (#11549) next »