Jump to content
php.lv forumi

attēli no mysql datubāzes


Cuba

Recommended Posts

vieniigais ko izdod kods ir pazinjojums Please use a real id number , kaut arī datu bāzē tāds id ir..

 

Te ir db skripts:

CREATE TABLE `images` (

`id_image` int(11) NOT NULL auto_increment,

`image` blob,

PRIMARY KEY (`id_image`)

) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

 

 

Un php:

<?php

 

error_reporting(E_ALL);

 

if(isset($_GET['id_image']) && is_numeric($_GET['id_image'])) {

 

$link = mysql_connect("localhost", "root", "xxxx") or die("Could not connect: " . mysql_error());

 

 

mysql_select_db("db") or die(mysql_error());

 

 

$sql = "SELECT image FROM images WHERE id_image = '2'";

 

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

 

 

header("Content-type: image/png");

echo mysql_result($result, 0);

 

 

mysql_close($link);

}

else {

echo 'Please use a real id number';

}

?>

 

Kur ir kljuuda ? :(

Edited by Cuba
Link to comment
Share on other sites

×
×
  • Create New...