And I am not sure how to incorporate two at the same time.. Could someone take a peek at the code and show me the correct way to do this? What I am trying to do is display the entry (which is id, name, phone, email, and password) from the 'part_name' table, and pull the company name from associated with the participant from the 'part_cpny' table. The association is 'RelCompID' variable.
Right now, with the second query string in there, only the company name is displayed, and all the other variables are blank. When removed, it's opposite.
Help!
Code:
<html>
<head>
<title>View Participant Information</title>
</head>
<body>
<?php
// Connect to database
$connect= mysql_connect("localhost","root")
or die("Could not connect to database in localhost !");
mysql_select_db("testdiw")
or die("Could not select that database !");
$name = $_GET['name'];
// The ID is passed through the URL to specify the row,
// Or it is set in the previous script.
$query = "SELECT * FROM part_name WHERE name = '$name'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$cpny_id = $row['RelCompID'];
$sqlquery1 = "SELECT * from part_company WHERE cpny_id = '$cpny_id'";
$query1 = mysql_query($sqlquery1) or die (mysql_error());
$row = mysql_fetch_array($query1);
echo '
<TABLE>
<TR>
<TD>Participant ID</TD>
<TD>'.$row['name_id'].'</TD>
</TR>
<TR>
<TD> Name:</TD>
<TD>'.$row['name'].'</TD>
</TR>
<TR>
<TD>Company/Firm:</TD>
<TD>'.$row['cpny_name'].'</TD>
</TR>
<TR>
<TD>Phone Number:</TD>
<TD>'.$row['phone_num'].'</TD>
</TR>
<TR>
<TD>Email Address:</TD>
<TD>'.$row['email_addr'].'</TD>
</TR>
<TR>
<TD>Password:</TD>
<TD>'.$row['password'].'</TD>
</TR>
</TABLE>';
?>
</BODY>
</HTML>