|
|
#1 |
![]() Join Date: Oct 2010
Posts: 340
|
I am getting the following error message:
Call to undefined function query() My code is this: if(!isset($_GET['id'])){ header('Location: index.php'); exit(); } else { $id = $_GET['id']; } $db = new mysqli('localhost', 'root', 'penbird098', 'blog') or die('error with connection'); if(!is_numeric($id)){ header('Location: blogIndex.php'); } $sql = query("SELECT title, body FROM posts WHERE posts_id='$id'"); $query = $db->query($sql); if($query !=1){ header('Location: index.php'); exit(); } I know from the error message it is something to do with: $query = $db->query($sql); But I can't figure out what. I have done a few searches on google and not really found anything that is helpful to me. Can someone please provide me with a bit of guidance. Many thanks Tony |
|
|
|
|
|
#2 |
![]() Join Date: Oct 2010
Posts: 340
|
well, it seems I'd been staring at the problem so long I couldn't see the wood for the trees.
$sql = query("SELECT title, body FROM posts WHERE posts_id='$id'"); was wrong, I didnt need query() |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|