tags:

views:

19

answers:

2

Hello, everybody!

I have the following code:

<?php
    $mysqli = new MySQLi($db_host, $db_user, $db_pass, $db_select);
    $stmt = $mysqli->prepare("SELECT new_title, new_subtitle, new_description FROM news WHERE new_id = ?");
    $stmt->bind_param("i", $selected_id);
    $stmt->execute();
    $stmt->bind_result($news_title, $news_subtitle, $news_description);
    $stmt->fetch();
    $stmt->free_result();
    $stmt->close();
    $mysqli->close();
?>
<?php echo $news_title; ?><br />
<?php echo $news_subtitle; ?><br />
<?php echo $news_description; ?>

The problem is that $news_description comes back empty although there is a value in the db! Please note that I encountered that problem before (with a different table and fields) but I did not try to solve it because I changed my plans regarding that page. Now unfortunately, I must solve it and I have been at for 3 days now and still no go!

Thank you!

A: 

Try

<?php
  while ($stmt->fetch()){
  echo $news_title, $news_subtitle, $news_description, '<br />';
  }
?>

Does this show anything?

egis
A: 

ok, I changed the data type of news_description, in the db, from longtext to varchar(255) and it worked!

Antonis Chatzikonstantis