PHP+MSSQL

This is a discussion on PHP+MSSQL within the PHP Language forums, part of the PHP Programming Forums category; Hi frenz Lately I try to use MSSQL and PHP , the problem arise when PHP try to read MSSQL field ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-28-2004
badz
 
Posts: n/a
Default PHP+MSSQL

Hi frenz

Lately I try to use MSSQL and PHP , the problem arise when PHP try to
read MSSQL field with 'image' data type,

header("Content-type: image/jpeg"); // act as a jpg file to browser

I try to used normal working file that store BLOB as file type in MSSQL
...but still not working. Is it because the image data type in MSSQL can
not be recognise by PHP?
Any one can give the hint.. thanks u in advance.

Reply With Quote
  #2 (permalink)  
Old 11-29-2004
Polaris
 
Posts: n/a
Default Re: PHP+MSSQL

If I understand you correctly, you put the image itself into the database?
Why ?
better is to put the link in the database and the image itself in the map in
the link is mutch better.

"badz" <badz22@gmail.com> schreef in bericht
news:1101679138.676387.56910@z14g2000cwz.googlegro ups.com...
> Hi frenz
>
> Lately I try to use MSSQL and PHP , the problem arise when PHP try to
> read MSSQL field with 'image' data type,
>
> header("Content-type: image/jpeg"); // act as a jpg file to browser
>
> I try to used normal working file that store BLOB as file type in MSSQL
> ..but still not working. Is it because the image data type in MSSQL can
> not be recognise by PHP?
> Any one can give the hint.. thanks u in advance.
>



Reply With Quote
  #3 (permalink)  
Old 11-29-2004
Gary L. Burnore
 
Posts: n/a
Default Re: PHP+MSSQL

On Mon, 29 Nov 2004 00:24:24 +0100, "Polaris"
<ask4polaris@hotmail.com> wrote:

Stop top posting.

>If I understand you correctly, you put the image itself into the database?
>Why ?
>better is to put the link in the database and the image itself in the map in
>the link is mutch better.


If you're saying put the image on a filesystem instead of in a
database, then you're missing rhe point of using a database.


>
>"badz" <badz22@gmail.com> schreef in bericht
>news:1101679138.676387.56910@z14g2000cwz.googlegr oups.com...
>> Hi frenz
>>
>> Lately I try to use MSSQL and PHP , the problem arise when PHP try to
>> read MSSQL field with 'image' data type,
>>
>> header("Content-type: image/jpeg"); // act as a jpg file to browser
>>
>> I try to used normal working file that store BLOB as file type in MSSQL
>> ..but still not working. Is it because the image data type in MSSQL can
>> not be recognise by PHP?
>> Any one can give the hint.. thanks u in advance.
>>

>


--
gburnore@databasix dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
DataBasix | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ÝÛ³
Black Helicopter Repair Svcs Division | Official Proof of Purchase
================================================== =========================
Want one? GET one! http://signup.databasix.com
================================================== =========================
Reply With Quote
  #4 (permalink)  
Old 11-29-2004
badz
 
Posts: n/a
Default Re: PHP+MSSQL

what I means is I tried to pull the image from MSSQL database which
used image as their data type not BLOB..
is it the reason I can not pull the image..
by the way the MSSQL table that I used is "view table"

Reply With Quote
  #5 (permalink)  
Old 11-29-2004
Tom Szabo
 
Posts: n/a
Default Re: PHP+MSSQL

?
> >Why ?
> >better is to put the link in the database and the image itself in the map

in
> >the link is mutch better.

>
> If you're saying put the image on a filesystem instead of in a
> database, then you're missing rhe point of using a database.
>


Or perhaps you are missing the point of simplicity and speed and
reliability.

Horses for courses. If it is something sensitive, yes storing in a database
is a reasonable solution.

If it is not sensitive at all, one must have the MS bug to do something like
that...

Regards,

Tom


Reply With Quote
  #6 (permalink)  
Old 11-29-2004
Gary L. Burnore
 
Posts: n/a
Default Re: PHP+MSSQL

On Mon, 29 Nov 2004 22:42:31 +1000, "Tom Szabo" <tom@intersoft.net.au>
wrote:

>?
>> >Why ?
>> >better is to put the link in the database and the image itself in the map

>in
>> >the link is mutch better.

>>
>> If you're saying put the image on a filesystem instead of in a
>> database, then you're missing rhe point of using a database.
>>

>
>Or perhaps you are missing the point of simplicity and speed and
>reliability.
>
>Horses for courses. If it is something sensitive, yes storing in a database
>is a reasonable solution.
>
>If it is not sensitive at all, one must have the MS bug to do something like
>that...
>
>


You don't know much about databases, eh?

A well written program with a well designed database can deliver your
miages quite quickly. Depending on the database, it can be twice as
fast or only somewhat faster. It's seldom slower than having
thousands of files in a directory for a program to search through.

It also has nothing to do with Microsoft.

Now if you could just learn how to attribute correctly, you'd have the
medium of USENet to list among things you know how to do.
--
gburnore@databasix dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
DataBasix | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ÝÛ³
Black Helicopter Repair Svcs Division | Official Proof of Purchase
================================================== =========================
Want one? GET one! http://signup.databasix.com
================================================== =========================
Reply With Quote
  #7 (permalink)  
Old 11-29-2004
Tom Szabo
 
Posts: n/a
Default Re: PHP+MSSQL

> You don't know much about databases, eh?
>
> A well written program with a well designed database can deliver your
> miages quite quickly. Depending on the database, it can be twice as
> fast or only somewhat faster. It's seldom slower than having
> thousands of files in a directory for a program to search through.
>
> It also has nothing to do with Microsoft.
>
> Now if you could just learn how to attribute correctly, you'd have the
> medium of USENet to list among things you know how to do.



Well I may not know much about them, but at least have 10 years of
experience and currently working on one similiar project and have one
program running for 3 years without a hickup with a few 100K pictures (0.5
TByte on Raid 5 controller). Well, I may not be doing things the way MS and
other "Authorities" suggest, but I usually end up with rock solid
solutions...

....my programs don't utilise the Registry, but they can be easily installed,
don't screw up, and have never done one machine, and one can run multiple
copies of it at the same time, if for same strange reason one needs to. One
may also run older versions of the same thing simultaneously...etc

This is not because of my higher IQ or because I am a smarter programmer. I
think it is simply because I don't overcomplicate things when it is not
needed...

I beleive in simple and elegant solutions, simple straight logic.

I still think, horses for courses! I like to see how will you deliver a
number of pictures from a database significantly quicker through an SQL
server than straight from a well organised Hierachical File Structure, which
gets pretty close to optimal binary search....

considering that you have to read the data from a hard-drive into say an SQL
server, than feed it to IIS

opposed to sending a link to the browser and IIS sends the files
down....also I am curious which will be more processor hungry?

And I agree with you on that a lot depend on the iumplementation :-)

Regards,

Tom



Reply With Quote
  #8 (permalink)  
Old 11-29-2004
Chung Leong
 
Posts: n/a
Default Re: PHP+MSSQL


"badz" <badz22@gmail.com> wrote in message
news:1101679138.676387.56910@z14g2000cwz.googlegro ups.com...
> Hi frenz
>
> Lately I try to use MSSQL and PHP , the problem arise when PHP try to
> read MSSQL field with 'image' data type,
>
> header("Content-type: image/jpeg"); // act as a jpg file to browser
>
> I try to used normal working file that store BLOB as file type in MSSQL
> ..but still not working. Is it because the image data type in MSSQL can
> not be recognise by PHP?
> Any one can give the hint.. thanks u in advance.
>


I use MSSQL in my project and manage to store/retrieve images from the
database with no problem. Here's what I suggest:

Check mssql.textsize in php.ini. If I remember correctly it affect blob as
well text type. Alternatively you could get the pointer to the blob and
retrieve the data a small chunk at a time using readtext.

Check the routine that stores the images. Maybe the image never made it into
the database in the first place. I can't remember what it is exactly but
there's a limit to how long a SQL statement can be in MSSQL.


Reply With Quote
  #9 (permalink)  
Old 11-30-2004
badz
 
Posts: n/a
Default Re: PHP+MSSQL

Hi frenz

first the image is put inside the db because of the user want it kept
the information inside the db not in specific folder or dir. Off course
there have issue on this, but the image file is not so big.

I had increase the file size in php.ini but the image seems not appear
at all.
I had use asp script and its able to display the image correctly, it
prove that there is no problem occur while inserting the image.

any one can share part of the code in retrieiving the image..
again the image is not 'BLOB data type' but MSSQL special 'image data
type'

Reply With Quote
  #10 (permalink)  
Old 12-01-2004
Chung Leong
 
Posts: n/a
Default Re: PHP+MSSQL


"badz" <badz22@gmail.com> wrote in message
news:1101803479.669986.122700@f14g2000cwb.googlegr oups.com...
> Hi frenz
>
> first the image is put inside the db because of the user want it kept
> the information inside the db not in specific folder or dir. Off course
> there have issue on this, but the image file is not so big.
>
> I had increase the file size in php.ini but the image seems not appear
> at all.
> I had use asp script and its able to display the image correctly, it
> prove that there is no problem occur while inserting the image.
>
> any one can share part of the code in retrieiving the image..
> again the image is not 'BLOB data type' but MSSQL special 'image data
> type'
>


Image = Blob in Microsoft-speak. There's nothing special about it. Just a
blob of binary data.

I don't know what you mean by 'file size in php.ini'. The settings that you
need to change are mssql.textsize and mssql.textlimit.

Again, PHP has no problem dealing if blobs from MS SQLServer. All you have
to do is select the column. You might need to place the blob column last.
Other than that it doesn't behave differently from other columns.

Post the actual code if you're still having problem. Kinda hard to guess at
what you're actually doing.


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:03 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0