pixeltrace Posted March 13, 2007 Share Posted March 13, 2007 guys, i need help, i have a page that should get items from 2 different tables specialization and applicant in the specialization, its as to display all items on the table for "specialization" in the applicant, it has to display the total number of counts equivalent to specialization ex. administration (1) agricultural (1) the administration and agricultural will be taken from the specialization table and the (1) will be taken from the applicant table below is my codes for this page <table width="558" border="0" cellspacing="2" cellpadding="3"> <tr> <td colspan="2" valign="top"><img src="images/spacer.gif" width="10" height="1" /></td> </tr> <tr> <td colspan="2" bgcolor="#999999" class="text2">RESUME MANAGER </td> </tr> <tr> <td colspan="2" valign="top"><img src="images/spacer.gif" width="10" height="10" /></td> </tr> <tr> <td colspan="2" valign="top" bgcolor="#83C2ED" class="text2">Specialization </td> </tr> <? $query = mysql_query("SELECT specialization FROM specialization") or die(mysql_error()); $row = mysql_fetch_array( $query ); $specialization = $row["specialization"]; ?> <tr> <td width="4" align="left" valign="top" class="text6"><img src="images/spacer.gif" width="4" height="10" /></td> <td width="536" align="left" valign="top" class="text6">» <? echo "$specialization";?> <a href="resumemngr.php?id=3&specialization=<? echo "$specialization"; ?>" class="link2">[ <? $query = mysql_query("SELECT specialization, COUNT(*) AS cnt FROM applicant WHERE specialization LIKE '%". $specialization ."%';") or die(mysql_error()); $row = mysql_num_rows($query); ?> <? echo "$row";?> ]</a></td> </tr> <? } } ?> </table> this codes are not working and i dont know how to fix it, hope you could help me with this. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/42451-need-help-on-getting-data-from-2-different-tables/ Share on other sites More sharing options...
s0c0 Posted March 13, 2007 Share Posted March 13, 2007 A few things. Are you getting any errors? If so post them. Next, maybe try changing the names of your variables, I don't think this is causing the problem, but change the variable names on your second set of queries. Are you getting any output at all? If the data in your tables spans more than one row you will need to echo all that out using a while or for loop. Just my 2 cents. Quote Link to comment https://forums.phpfreaks.com/topic/42451-need-help-on-getting-data-from-2-different-tables/#findComment-206018 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.