i am doing a site for appliance center..
i need to display all the products that the company offers, but my problem is that i cant display ALL the images in my database.. the first entry on the database is the only one that displays..
i am using mysql as database
here's the code.. tell me what's my error and pls. kindly edit it..
**imgdata = it is where i store the image.. longblob is the data type -
<?php
-
$errmsg = "";
-
if (! @mysql_connect("localhost","root",""))
-
{
-
$errmsg = "Cannot connect to database";
-
}
-
@mysql_select_db("upload");
-
-
$gotten = @mysql_query("select imgdata from pix");
-
header("Content-type: image/jpeg");
-
while ($row = mysql_fetch_array($gotten))
-
{
-
print $row['imgdata'];
-
-
}
-
mysql_free_result($gotten);
-
?>
Feb 6 '08
48 41438
how many bytes worth of space are all the photos you will be uploading.
my personal preference is to store images in the DB, if the server can't handle it update the hardware, and software.
how many bytes worth of space are all the photos you will be uploading.
my personal preference is to store images in the DB, if the server can't handle it update the hardware, and software.
would there be a problem if i export/import it from one pc to another?
How much space worth of images are you likely to save in the DB?
is it a commercial project, uni project?
How much space worth of images are you likely to save in the DB?
is it a commercial project, uni project?
hi.. i've already solved this.. hehe.. i'll be continuing what i am doing.. but i'll be having a tutorial for server side coding...
cool. if you're pnly returning the images one at a time, and you becareful with your "select *" 's it won't slow anything down too much
OMG!! I'v bin lookin for this for sooooooooooo long! all of u r life savers!!!!! thaaaaaaaaaaaaa aaaaaaaanks!!! I'm a newbie myself :( thanks thanks... :)
Hey everyone...
I've tried following this thread, and can't seem to get the code to work! I've been working on this for hours now, and i'm going crazy here lol
When I go to test2.php (which should show me the images), all it shows are image placeholders! It's pulling the images somewhat correctly, if I upload another image to the table...it'll show another placeholder, and viewing properties on the images shows the correct URL...the image just isn't showing up at all :( Can anyone help?
Here's my code:
test.php - <?php
-
$errmsg = "";
-
if (! @mysql_connect("localhost","root","welcome"))
-
{
-
$errmsg = "Cannot connect to database";
-
}
-
@mysql_select_db("emotion");
-
-
if (IsSet($_GET['image_id'])){
-
$gotten = @mysql_query("select image, type from whats_hot where image_id = ".$_GET['image_id']);
-
list( $type,$data ) = mysql_fetch_row( $query );
-
header("Content-type: {$type}");
-
while ($row = mysql_fetch_array($gotten,MYSQL_ASSOC))
-
{
-
print $row['image'];
-
-
}
-
mysql_free_result($gotten);
-
}
-
?>
test2.php -
-
<?php
-
$errmsg = "";
-
if (! @mysql_connect("localhost","root","welcome"))
-
{
-
$errmsg = "Cannot connect to database";
-
}
-
@mysql_select_db("emotion");
-
-
$strSQL = "select * from whats_hot";
-
$rsPix = mysql_query($strSQL);
-
$numRows = mysql_numrows($rsPix);
-
$i = 0;
-
-
while($i < $numRows){
-
?>
-
<img src="test.php?image_id=<?php echo mysql_result($rsPix,$i,"image_id"); ?>"/>
-
<?php
-
$i++;
-
}
-
?>
-
-
my whats_hot table is set up like so:
image_id (int) auto_increment
image (MEDIUMBLOB)
type (varchar)
@harshmaul
This page has a lot of great information, and I'm glad Bytes has such active and helpful members. I'm a bit confused though. I was wondering if you could help me out.
I'm trying to achieve basically the same thing that these two pages (pix.php and list.php) seek to create. I'd like to take the images from a database, and show those images to my website users in a nice neat little column. You don't need to show me any code, you've already done that. I just have a few questions.
So the first thing I need to do is set up my tables with a BLOB field labeled imgdata, and a pixID field labeled..... well, what exactly is the pixID field, and how should it be labeled? What are the signifigance of each of these pages? Which part of the code am I just referencing to, and which part actually shows the image? I'd just like a little clarification. I'm awfully new to this. Thanks Bytes.
-Tim
Hi everyone,
I tried to make this to work but I am having the same problem as vinco83. The images seems to get retrived correctly but it only shows the placholder not image. when I debugged it says that "ID not found in Msyql result index 5"
Looking forward to hear from you soon !
Best regards,
Naim
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Tan |
last post by:
Hi
I am desperate for any help with display image in Gridview
I have a gridview contain surname , forename ..... and image. I could not
display image as my database store the column image as image not text.
I have tried all sort of things like converting the columns image to tempate
so on and still could display image
|
by: harish |
last post by:
Hi friends
I am facing problem as follow
I can't display image from SQL Database to Picture box
Control.
Here are the codes that I am writing
Dim arrPicture() As Byte = _
|
by: RedSouljaz |
last post by:
Hi,
How to display image that was saved in database ms sql
server 2000 into picture box. The field type that I use
in database is Images
I can save to database but cannot show from database.
Thanks
|
by: den 2005 |
last post by:
Hi everyone,
Here is code working on..Trying to insert record with a column with Image
or VarBinary datatype in sql database from a existing jpeg image file, then
retrieve this image from database and display it in a Image web control
dynamically(at runtime).
The process after being displayed in the web control, user click insert/add
button, it converts the image(jpeg) file to bytes and store it the database
with Image or VarBinary...
|
by: eholz1 |
last post by:
Hello Group,
Perhaps you can help me. I have a mysql db, that holds images.
Images are encoded using base64_decode/encode, etc. Image data seems
fine.
I have a view.php page that is supposed to show the image, and an
image.php page that accesses
the database, retrives the image data, and then (theoretically) prints
the decoded data to the page.
below is the view.php page code: problem area the img tag src no
| |
by: alexseow |
last post by:
Query.asp
<%@ LANGUAGE="VBSCRIPT" %>
<!-- #include file="../../includes/dbconn.asp"-->
<%
dim MyRs, sqlstr, MyConn
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear
|
by: shalini328 |
last post by:
I am using ASP.net 1.1 C# and database is MS access.Can you tell me how can i display image from database
|
by: saadkhan |
last post by:
I want to display image in <img> tag using database. I just need to know that how could i be able to define path or whatever to <img> tag. I have no probem in making queries to database.....plz help
|
by: SafaaDalloul |
last post by:
Please I want know How I can Display Image from database randomly when the web page refresh in Asp.net by C# code
|
by: Laxmikant |
last post by:
I am using VB6 as front end, Access 2007 as backend, crystal report 8 for reporting.
I want to display image on my crystal report output, based on path saved in a table in Access Database.
Is it possible to do so?
If yes, how?
Help ASAP..
Thanks in advance.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |