Ok, so I have been at this for hours now, and no matter what i do, it just doesn't work. I've read pages of documentation and even tried verbatim by examples, and still doesn't work:
$db = mysqli_connect($db_server, $db_user, $db_passwd, $db_name);
if (mysqli_connect_errno())
{
printf("Connect failed: %s
", mysqli_connect_error());
exit();
}
$db_query = "SELECT ca.id_article, ca.title, ca.body, ca.id_tag, ca.visible, ct.title AS tag_title
FROM cdfi_articles AS ca
INNER JOIN cdfi_tags AS ct ON(ct.id_tag = ca.id_tag)
WHERE ca.id_article = ?
LIMIT 1";
;
if ($stmt = mysqli_prepare($db, $db_query)) {
mysqli_stmt_bind_param($stmt, "i", $_REQUEST['article']);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $return);
mysqli_stmt_fetch($stmt);
var_dump($return);
}
mysqli_close($db);
The following error occurs and I don't know how to fix it at all:
Warning: mysqli_stmt_bind_result() [function.mysqli-stmt-bind-result]: Number of bind variables doesn't match number of fields in prepared statement in ... filepath on line {line number}
bind variables
don't match? I am only using 1 variable, and only 1 question mark within the query, what gives??
var_dump($return)
returns NULL
value
How can I fix this? I just want to get that 1 row returned within the $return
variable so that I can do something with it, arggg!