Jump to content

Recommended Posts

Hi,

I have two tables in a db : individual and groups

 

Individual:

T1 -is a booking ref (auto increment)

T2 -is a group ref

 

Group:

ID -is ID Number (auto increment)

name -is a group name

 

What id like to do is match T2 in individual with ID in groups to show 'name' on a php page.

 

Any ideas in the right direction would help alot!! Im completely stuck

 

My php code works in order to show everything from individual in tables in php:

<?php
$username="username";
$password="password";
$database="database";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM individual";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

?>

<table width="100%" border="2" bordercolor="#000000" cellpadding="2" cellspacing="0"  rules="rows" frame="hsides">
<tr>
<th class="style1" align="left">Booking Ref</th>
<th class="style1" align="left">Group ID</th>
<th class="style1" align="left">Group name</th>
</tr

<?
$i=0;
while ($i < $num) {

$T1=mysql_result($result,$i,"T1");
$T2=mysql_result($result,$i,"T2");
?>

<tr>
<td class="style1" width="200"><? echo $T1; ?></td>
<td class="style1" width="200"><? echo $T2; ?></td>
</tr>

<?
$i++;
}

echo "</table>";
?>

 

 

 

Thanks !!!!

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.