In my database, I have a task table, which you can say is the main table in my database. I have a column called category, and this column points to a table called a category that contains different categories.
Taking up the concept of foreign keys, I turned the categories of columns into a foreign key that looks at the category table.

In my category table, I make sure that it points to an identifier.

When I launch my web page, it prints the value 1 in the category column, when theoretically it should not print “Driving”?

function getJobDetails($job,$cat){
include "connectToDatabse.php";
$results = $pdo->query("SELECT * FROM job WHERE category LIKE '$cat%' OR title LIKE '$job'");
$str = "<table>";
$str .= "<td>" ."Title" . "</td>";
$str .= "<td>" ."Reference" . "</td>";
$str .= "<td>" ."Salary(£)" . "</td>";
$str .= "<td>" ."Description" . "</td>";
$str .= "<td>" ."Category" . "</td>";
foreach ($results as $row) {
$ref = $row['reference'];
$link = "<form method='get' action='apply.php' name='edit'>
<input type='hidden' name='referenceNumber' value='$ref'>
<input type='submit' value='$ref'>
</form>";
$str .= "<tr>";
$str .= "<td>" . $row['title'] . "</td>";
$str .= "<td>" . $row['reference'] . "</td>";
$str .= "<td>" . $row['salary'] . "</td>";
$str .= "<td>" . $row['description'] . "</td>";
$str .= "<td>" . $row['category'] . "</td>";
$str .= "<td> " .$link . "</td>";
$str .= "</tr>";
}
$str .= "</table>";
echo $str;
}
The above code is a function that returns data in a job table.
: , , ?