How do I bring a mediumblob into php?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Nathan Brignall
Forum Newbie
Posts: 2
Joined: Fri May 16, 2008 1:57 pm

How do I bring a mediumblob into php?

Post by Nathan Brignall »

Hey,

I have a mysql table with several fields in it. I'm not having any trouble with any of the varchar fields, but how to get the mediumblob field has really got me stumped. Does anyone know how to SELECT a mediumblob from a mysql table and bring it into php?
User avatar
idevlin
Forum Commoner
Posts: 78
Joined: Tue Jun 26, 2007 1:10 pm
Location: Cambridge, UK

Re: How do I bring a mediumblob into php?

Post by idevlin »

Why? Just perform a select and store it in a variable, it works fine for me? What exact trouble are you having?
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: How do I bring a mediumblob into php?

Post by Jade »

I'm not sure what sql you're using but I know microsoft sql has issues with blobs/texts. For those you need to select the blob/text at the end of the select statement otherwise it has issues. Dunno but maybe that'll help.
Nathan Brignall
Forum Newbie
Posts: 2
Joined: Fri May 16, 2008 1:57 pm

Re: How do I bring a mediumblob into php?

Post by Nathan Brignall »

I'm using it to store images. Thanks for the help. How would I get all my pictures to come onto the page? So far I only get the first image in the database.

<?php

$link = mysql_connect ("localhost", "mystuff", "mystuff");
mysql_select_db ("mystuff");

$result = mysql_query("SELECT mystuff FROM mystuff");
header("Content-type: image/jpeg");
echo mysql_result($result, 0);

?>
Post Reply