|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Storing Images in Database
I need immediate help with my project. I have 4 different tables that show product prices, description and so forth. I would also like to have images for each product. I've heard of BINARY, BLOB and using URLS, but I've no clue how to use these commands (I'm beginner at this) This is my code so far, but instead of retrieving an image, I get the URL string as I wrote it. I'ld appreciate your help.
$create = " CREATE TABLE CClassTable ( product VARCHAR (64) NOT NULL, description VARCHAR (64) DEFAULT NULL, reference INT (5) DEFAULT NULL, price VARCHAR(15), PRIMARY KEY (reference), KEY (description) )"; /** *fill CClass table */ $CClassRow1 = "INSERT INTO CClassTable VALUES ('http://C:\Documents and Settings\My Documents\Project/cdchanger.jpg/','CD Changer','1018','$55.20/EA')"; $CClassRow2 = (...AND SO ON....) Thanks in advance! |
|
#2
|
|||
|
|||
|
Using the wrong datatype.
varchar is text not image S- |
|
#3
|
|||
|
|||
|
Storing Images in Database
what is the right datatype for an image? Thanks
|
|
#4
|
||||
|
||||
|
Quote:
It depends on what database you are using. |
|
#5
|
|||
|
|||
|
I'm using SQL Database
|
|
#6
|
||||
|
||||
|
Quote:
SQL isn't a database, it's a language (Structured Query Language) that is used to communicate with databases. If you mean SQL Server, then use the image data type. |
|
#7
|
|||
|
|||
|
When you say image data type, you mean when I create a table, I should identify the image field as follows (sorry, I'm a beginner at this)$create = "
CREATE TABLE CClassTable ( product IMAGE (1) NOT NULL, description VARCHAR (64) DEFAULT NULL, reference INT (5) DEFAULT NULL, price VARCHAR(15), PRIMARY KEY (reference), KEY (description) )"; //fill CClass table// $CClassRow1 = "INSERT INTO CClassTable VALUES ('http://documents/dynamic/Fina20Project/images/cdchanger.jpg','CD Changer','1018','$55.20/EA')"; (...AND SO ON...) |
|
#8
|
||||
|
||||
|
Code:
Create Table [CClassTable] ([productImage] [image] NOT NULL) |
|
#9
|
|||
|
|||
|
Thanks!
|
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Storing Images in Database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|