MYSQL Two Tables Join Issue
Posted: Sun Nov 26, 2017 8:46 pm
Hello again, I apologize if I am posting too much, I'm just getting stuck a bit more the deeper I get in to my game. Being a novice programmer I assumed this sort of stuff would happen. Anyways, here's my problem.
I am trying to display move names from a db. I have a $_GET['id'] stored in the variable $id. I am using this var to query a specific moveset from my moveset table. From there I need to output each move column (weak1,weak2,medium1,medium2,etc...) which has a moveid stored for its value and coresponds with the moveid in the moves table. Ultimately I want to just display the movename but have to pull the user profiles ID, get their moveset, then pull each moveid in their moveset, then match that moveid to the moveid in the moves table and in return pull the movename.
Here is my current code but it is only echoing the moveid:
I am trying to display move names from a db. I have a $_GET['id'] stored in the variable $id. I am using this var to query a specific moveset from my moveset table. From there I need to output each move column (weak1,weak2,medium1,medium2,etc...) which has a moveid stored for its value and coresponds with the moveid in the moves table. Ultimately I want to just display the movename but have to pull the user profiles ID, get their moveset, then pull each moveid in their moveset, then match that moveid to the moveid in the moves table and in return pull the movename.
Here is my current code but it is only echoing the moveid:
Code: Select all
echo "<h3>Moves:</h3>"; // List moves of wrestler
$sql3 = "SELECT movesets.*, moves.* FROM movesets WHERE movesets.wrestlerid = '$id'";
$result3 = mysqli_query($conn, $sql3);
while($row3 = mysqli_fetch_assoc($result3)) {
echo $row3["weak1"] . "," .
$row3["weak2"] . "," .
$row3["weak3"] . "," .
$row3["weak4"] . "," .
$row3["weak5"] . "," .
$row3["medium1"] . "," .
$row3["medium2"] . "," .
$row3["medium3"] . "," .
$row3["medium4"] . "," .
$row3["medium5"] . "," .
$row3["strong1"] . "," .
$row3["strong2"] . "," .
$row3["strong3"] . "," .
$row3["strong4"] . "," .
$row3["strong5"] . "," .
"<br>";}