Waarom kan ik niet includen op de volgende manier?
Admin.php:

$id = $row['id'];
$var = include('display_image.php?id=3');
$result = mysqli_query($conn,$sql) or die ("Error in query: $query. ".mysqli_error($conn));
if (mysqli_num_rows($result) > 0) {  
    echo "<table class='bart' height=100px width=500px>";	
    while($row = mysqli_fetch_array($result))      {
echo "<tr>";
echo $var;


display_image.php:

<?php
 include "conf.php";
 // just so we know it is broken
 error_reporting(E_ALL);
 // some basic sanity checks
 if(isset($_GET['id']) && is_numeric($_GET['id'])) {
     //connect to the db
     $link = mysql_connect("$host", "$user", "$pass")
     or die("Could not connect: " . mysql_error());

     // select our database
     mysql_select_db("$db") or die(mysql_error());

     // get the image from the db
     $sql = "SELECT image FROM test_image WHERE id=" .$_GET['id'] . ";";

     // the result of the query
     $result = mysql_query("$sql") or die("Invalid query: " . mysql_error());

     // set the header for the image
     header("Content-type: image/jpeg");
     echo mysql_result($result, 0);

     // close the db link
     mysql_close($link);
 }
 else {
     echo 'Please use a real id number';
 }
?>


[size=xsmall]Toevoeging op 29/06/2016 12:38:16:[/size]

HIj geeft dan de error:

Warning: include(display_image.php?id=3) [function.include]: failed to open stream: No error in C:\xampp\htdocs\PHProject\admin.php on line 108

Warning: include() [function.include]: Failed opening 'display_image.php?id=3' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\PHProject\admin.php on line 108
LOL, helemaal overheen gelezen bij het copypasten, maar <a><button></a> is inderdaad geen goed idee.

Reageren