Bear with me I realize there are many posts about this error. But I have looked through them and can't seem to find the solution for my particular problem.
I have tried "isi", "sss", and "sii" doesn't work. Not sure what to do any help would be great.
Not too sure where to use var_dump(); to find out more information about my problem. I'm pretty new to PHP that would help a lot too, to know.
Thanks for bearing with me! Sorry about a repeat topic.
code:
<tr>
<form action="Voting_action.php" method="post">
<td><br />
<input type="submit" class="buttontable1" value="<?php echo $random; ?>" name="name"/>
</td>
</form>
<form action="Voting_action.php" method="post">
<td><br />
<input type="submit" class="buttontable1" value="<?php echo $random3; ?>" name="name"/>
</td>
</form>
</tr>
<tr>
<form action="Voting_action.php" method="post">
<td><br />
<input type="submit" class="buttontable1" value="<?php echo $random6; ?>" name="name"/>
</td>
</form>
<form action="Voting_action.php" method="post">
<td><br />
<input type="submit" class="buttontable1" value="<?php echo $random4; ?>" name="name"/>
</td>
</form>
</tr>
<tr>
<form action="Voting_action.php" method="post">
<td><br />
<input type="submit" class="buttontable1" value="<?php echo $random5; ?>" name="name"/>
</td>
</form>
<form action="Voting_action.php" method="post">
<td><br />
<input type="submit" class="buttontable1" value="<?php echo $random2; ?>" name="name"/>
</td>
</tr>
<?php
include ('login-home.php');
$mysqli = new mysqli("", "", "", "");
if ($mysqli->connect_error) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_error . ") " . $mysqli->connect_error;
}
if (!($stmt = $mysqli->prepare("INSERT INTO table(id, name, votes) VALUES (id, '".$_POST['name']."', '".$votes."')"))) {
echo "Prepare failed: (" . $mysqli->error . ") " . $mysqli->error;
}
$id = 1;
This line:
if (!$stmt->bind_param("isi",$id, $_POST['name'], $votes)) {
echo "Binding parameters failed: (" . $stmt->error . ") " . $stmt->error;
}
if (!$stmt->execute()) {
echo "Execute failed: (" . $stmt->error . ") " . $stmt->error;
}
$stmt->close();
?>