perhaps this is a duplicate question, but I have read very many threads that deal with this issue and I can not find the solution, if indeed this is a duplicate question and I apologize if you do not mind give me a link that can help me. the problem is this: for reasons of my hosting plan I can not use 'mysqli_stmt_get_result ()' so I try to change the script I wrote (I'm just learning php), but then you run the query have no way to obtain the results of the consultation which if obtenia using 'mysqli_stmt_get_result ()', as an alternative to this I am trying to get that result with 'mysqli_store_result' which according to the documentation alcanso to read (as I understand) "Returns a buffered result object or FALSE if an error occurred." should (if all goes well) give me the same result I have with 'mysqli_stmt_get_result ()' and should only return "FALSE" in case something went wrong, but what I do I always get a Boolean = true. Could someone help me I'm doing wrong ?, some easy replacement of 'mysqli_stmt_get_result ()'? this is a fragment of what I have to code:
$link = new mysqli(
"localhost",
"root",
"RootPass",
"DB"
);
echo "
";
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
exit();
}
if($_GET){
$where_value = trim(htmlspecialchars($_GET["where"]));
}else{
if(count($argv)>1){
$where_value = trim($argv[1]);
}else{
$where_value = '';
}
}
if($where_value != ''){
if($stmt = $link->prepare('SELECT * FROM Tabla_1 WHERE ID=?')){
$stmt->bind_param('i', $where_value);
}else{
echo mysqli_stmt_errno;
exit();
}
}else{
if(!$stmt = $link->prepare('SELECT * FROM Table_1')){
echo mysqli_stmt_errno;
exit();
}
}
$stmt->execute();
$result = $stmt->store_result(); // Store "true" but must be 'mysqli_result'
// From this point none work because $result is a boolean not a 'mysqli_result'
$resultArray = array();
$tempArray = array();
while($row = $result->fetch_array(MYSQLI_NUM)){
$tempArray = $row;
array_push($resultArray, $tempArray);
}
mysqli_close($con);
echo json_encode($resultArray);
'Mysqli_stmt_bind_result' is not an option for me because the table has lots of columns, unless you can use an array for the 'mysqli_stmt_bind_result'.
my sistem is:
php --version
PHP 5.6.9-0+deb8u1 (cli) (built: Jun 5 2015 11:03:27)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.1 (jessie)
Release: 8.1
Codename: jessie
uname -a
Linux Iwakura-PC 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) x86_64 GNU/Linux
Please any help will be greatly appreciated