![]() |
storing images in database
hi all,
i want to store an image in MYSQL database.please tell me whether the below sql syntax i have written is correct or not. Code:
CREATE TABLE IF NOT EXISTS `products`(below is the one..... Code:
INSERT INTO `products` (`serial`, `name`, `description`, `price`, `picture`) VALUESi know for storing pictures we should give BLOB data type. but tell me whether the above syntax i have written will work or not. if not what would be the syntax... |
Re: storing images in database
No varchar(80) expects a character length of only 80. If the images character length is only 80 then yes but in most cases it will not be and will not work. Instead go with BLOB if you absolutely need to store them in the database. Its a best practice to store them in the filesystem so your not using up resources when your performing the query. A query for a fixed text length is far less on memory and the processor then one for an image files. I'd suggest that you store the link to the image in file or the directory and the file name is different columns.
|
Re: storing images in database
I agree with pein87.
|
Re: storing images in database
@ravi951 u can do as per ur wish .. using the varchar datatype for storing the image is not a prob.
But as Pein87 said it should not exceed the bound. here is the code : image.php Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">nexttpage.php Code:
<?phpHope i was able to help u out . enjoy coding .. :) |
| All times are GMT +5.5. The time now is 07:16. |