Hi!
so, now on a page where my script lists all entries from the table, everything works fine.. Works fine when I list the company by ID# and not by name. It works as coded below, but I want to display the company name rather than the associated ID.
code:
<html>
<head>
<title>List Participant Names</title>
</head>
<body>
<?PHP
$connect= mysql_connect("localhost","root")
or die("Could not connect to database in localhost !");
$result=mysql_select_db("testdiw")
or die("Could not select that database !");
$sqlquery = "SELECT name_id, name, RelCompID, password FROM part_name";
$queryresult = mysql_query($sqlquery) or die(" Could not execute mysql query !");
$row = mysql_fetch_row($queryresult);
$name_id = $row[0];
$cpny_name = $row[1];
$name = $row[2];
$password = $row[3];
$tdcount = 1;
$numtd = 1; // number of cells per row
echo '
<TABLE>
<tr>
<td> ID </td>
<td>Company/Firm </td>
<td> Name </td>
<td> Password </td>';
while($row = mysql_fetch_array($queryresult)) {
if ($tdcount == 1) echo "<tr>";
echo '<td> '.$row['name_id'],'</td><td>'.$row['RelCompID'].'</a></td><td><a href="select_part_name.php?name='.$row['name'].'">'.$row['name'].'</a></td><td> '.$row['password'],'</td>';
if ($tdcount == $numtd) {
echo "</tr>";
$tdcount = 1;
} else {
$tdcount++;
}
}
// time to close up our table
if ($tdcount!= 1) {
while ($tdcount <= $numtd) {
echo "<td> </td>";
$tdcount++;
}
echo "</tr>";
}
echo '</table> ';
?>
</BODY>
</HTML>
and I have tried changing the above to include this, to no avail:
$cpny_id = $row['RelCompID'];
$sqlquery1 = "SELECT * from part_company WHERE cpny_id = '$cpny_id'";
$query1 = mysql_query($sqlquery1) or die (mysql_error());
$row1 = mysql_fetch_array($query1);
$name_id = $row[0];
$cpny_name = $row1[1];
$name = $row[2];
$password = $row[3];