How to store Pictures in MYsql

Status
Not open for further replies.

Butterfly

Broken In
Folks ,

How do i store pictures in MYSQL , plz give me step by step , as am very new to this Mysql.. so what i wanted to do is that , umm i wanted to store picture and description of the pic intodatabase and then show it in the form..

i dont mind if u make one for me ..

thanks a lot , will count on u all experts and intil;igent , as am so dull lol
 

Deep

Version 2.0
I am assuming you are using PHP/MYSQL

as far as i know you cannot store images or anything into the database, you will have to store location of the image..

your database structure can be like this..

table pics..

Code:
CREATE TABLE `pics` (
  `id` int(11) NOT NULL auto_increment,
  `pic_title` varchar(100) NOT NULL default '',
  `pic_url` varchar(100) NOT NULL default '',
  `pic_description` text NOT NULL,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;

now to need to show these values into webpage..

Code:
<?php

// Database connection strings
$mysql_connect = mysql_connect($host,$username,$password) or die ("Sorry, I am not able to CONNECT to the Database");
$mysql_select_db = mysql_select_db($mysql_db) or die ("Sorry, I am not able to SELECT the Database");

// Database query

$sql = "SELECT id,pic_title,pic_url,pic_description WHERE id = '$id'";
$result = mysql_query($sql);

// Start fetching the values from Database

$row=mysql_fetch_array($result)

$pic_title = $row[pic_title];
$pic_url = $row[pic_url];
$pic_description = $row[pic_description];
?>


<form name="pic" action="pic-action.php" method="POST">



<textarea name="description">
<?php echo $pic_description; ?>



</textarea>

</form>

that's it..

i hope this helps you..
Deep
 
OP
B

Butterfly

Broken In
Thanks a lot Deep

Deep,

Thank u so much for that , yeah surely i will try and use ur coding , i have never know that we cantont store pic into database , now i do ..it has to be given url to the pic right ..

Once again thanks a lot ..
 

Deep

Version 2.0
no probs...

yes u have to give url of pic in the table
let me know if it doesnt work :)

Deep
 

xenkatesh

Bewitched!
If not try this link for more information! i guess!!!@

*www.google.co.in/search?hl=en&ie=ISO-8859-1&q=storing+pictures+in+mysql&meta=
 
Status
Not open for further replies.
Top Bottom