let's say if I have a query select users.user_id, users.fname, users.lname, bios.bio, groups.groupid from users LEFT JOIN bios on users.user_id = bios.userid , then I want to add another table to the state, and then add the where clause at the end. The problem is that when I bind the parameter, he said that βthe number of variables does not match the number of variables in the preparation statementβ. How can i solve this? Greetings. Example:
$info = "select users.user_id, users.fname, users.lname, bios.bio, groups.groupid from users LEFT JOIN bios on users.user_id = bios.userid"; $content = $members->prepare($info); if ($_GET['where'] == 'requests') $info .= "LEFT JOIN requests on users.user_id = requests.receiver"; else if ($_GET['where'] == 'referrals') $info .= "LEFT JOIN referrals on users.user_id = referrals.receiver"; $info .= "where users.user_id = ?"; $content->bind_param('s', $_SESSION['token'][1]); $content->execute();
source share