Afisare BLOB ce contine cod html

Secţiune dedicată începatorilor.

Moderatori: Moderatori, Start Moderator

tamara
PHPRomania Supporter
Mesaje: 11
Membru din: Mie Apr 27, 2011 3:36 pm

Afisare BLOB ce contine cod html

Mesajde tamara » Lun Aug 18, 2014 2:04 pm

Buna,
Daca ma poate ajuta cineva si pe mine intr-o problema.

Am o baza de date (SQL Server 2012) ce contine mai multe tabele. Intr-unul din tabele am un camp de tip image(blob) care contine text html. Cum trebuie sa fac sa afisez in browser acel text html?

Codul meu este:

Cod: Selectaţi tot

$myServer = "localhost/SQL2012";
$myUser = "sa";
$myPass = "1234";
$myDB = "DataBase_test";

$conn = new COM("ADOBE.Connection")
 or die("Cannot start ADO");

$connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;
$conn->open($connStr);

$query = "select texthtml from documente where cod_document = 173719";
$rs = $conn->execute($query);

while(!$rs->EOF){
       $blob_data = $rs['texthtml']->value;
       $rs->MoveNext();
}

echo $blob_data;


Multumesc



Avatar utilizator
iluc
Junior Member
Mesaje: 39
Membru din: Dum Mai 29, 2011 11:49 pm
Localitate: Focsani
Contact:

Re: Afisare BLOB ce contine cod html

Mesajde iluc » Lun Aug 18, 2014 11:05 pm

De ce nu bagi in baza de date, doar numele imagini, nu prea are rost sa bagi si cod html.

Cod: Selectaţi tot

while(!$rs->EOF){
       $blob_data = $rs['texthtml'];
       $rs->MoveNext();
       echo "<img src=http://localhost/imagini/".$blob_data." />
}
// $blob_data = imaginea_ta.png


Înapoi la “PHP Incepători”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 42 vizitatori