1

I have written a php script with prepared statements. on my local xampp server (PHP Version 5.5.15, MYSLQI mysqlnd 5.0.11-dev) It works perfectly. Now changing the Server (PHP Version 5.3.26, MYSQLI 5.1.36) it does not work anymore. It starts executing the script but stops directly before the first get_result() order.

//read DB entries
$sql_topic = "SELECT * FROM topic ORDER BY ID DESC";

$var = "naventry";

//prepared statement
$query = $mysqli->prepare($sql_topic);
$query -> execute();
//-------------------

//topic loop
if ($query = $query->get_result()) {
    while($topic = $query->fetch_assoc()) {

There's no information in the error logs and I don't have a clue where to search for the solution.

I hope for your help!! pplopp

Asenar
  • 6,732
  • 3
  • 36
  • 49
pplopp
  • 11
  • 2
  • @pplopp: If you don't see the errors, you should increase your error reporting until you actually see them. PHP doesn't usually die without any messages. (Unless there's a segfault or something, but this is very rare.) – lxg Oct 24 '14 at 17:56

1 Answers1

0

To have more clue about what's wrong, test every output of your code:

// enable all errors for debugging
error_reporting(E_ALL);
ini_set('display_errors', 'On');

$query = $mysqli->prepare($sql_topic);
if (!$query)
  die($mysqli->error);
$res = $query->execute();
if (!$res)
{
   die($query->error);
}

Remember to remove theses errors display when putting your code on production (or replace the die() by debug() (you need to write your own), or file_put_contents, error_log, ...

Asenar
  • 6,732
  • 3
  • 36
  • 49