Jump to content

need help on getting data from 2 different tables


pixeltrace

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.