Last active
December 20, 2015 07:38
-
-
Save Crakila/6094396 to your computer and use it in GitHub Desktop.
I am getting a error when I run this. It's saying "Fatal Error: Call to undefined method mysqli_result::bind_params() in <file location> on line 18". It's complaining about the $query->bind_params line. Any help would be appreciated. Thanks! EDIT: Fixed. On Line 17, I had "if($query = $db->query($sql)){" instead of "if($query = $db->prepare($sql…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
require"db_cnt.php"; | |
$sql = "SELECT forum_id, forum_name FROM forum_tabl"; | |
if(isset($_GET['id'])&&is_numeric($_GET['id'])){ | |
$id = $_GET['id']; | |
}else{ | |
die("ERROR!"); | |
} | |
//check if forum has valid id | |
$idCheck = $db->query("SELECT * FROM forum_tabl WHERE forum_id = '$id'"); | |
if($idCheck->num_rows !==1){ | |
die("No forum under that id was found!"); | |
} | |
$row = $idCheck->fetch_object(); | |
$sql = "SELECT post_id, post_title FROM forum_post WHERE forum_id=1 AND post_type='o' "; | |
if($query = $db->prepare($sql)){ | |
$query->bind_params('s', $id); | |
$query->bind_result($post_id, $post_title); | |
$query->execute(); | |
$query->store_result(); | |
}else{ | |
echo $db->error; | |
} | |
?> |
Updated to show fix. Check revisions for changes to the code
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated to show whole php file.