I'm learning PHP/MySQL so I hope this makes sense and is simple.
I'm trying to create a simple database which just displays info form the db.
The user can also add/remove from the db
I have a page which displays all the information from a table with a delete button
I have a form on a page
The tables I have are squad
The question that I have is, is it possible for the number that is entered for squad number, to be also assigned to the intid?
What I want to have is, the data from the table that contains all the player info (squad), and the data that contains international caps and goals (international), to be linked together.
The problem I have is that when someone enters a player by the form, the intid comes up as null.
The code I currently have is:
if (isset($_POST['squadnum'], $_POST['name'], $_POST['position'], $_POST['preffoot']))
$squadnum = mysqli_real_escape_string($link, $_POST['squadnum']);
$name = mysqli_real_escape_string($link, $_POST['name']);
$position = mysqli_real_escape_string($link, $_POST['position']);
$preffoot = mysqli_real_escape_string($link, $_POST['preffoot']);
$sql = 'INSERT INTO squad SET
squadnum="' . $squadnum . '",
name ="' . $name . '",
position ="' . $position . '",
preffoot ="' . $preffoot . '"';
if (!mysqli_query($link, $sql))
$error = 'Error adding player: ' . mysqli_error($link);
I hope this makes sense!