Jump to content


Photo

My First Database! -- Images


  • Please log in to reply
1 reply to this topic

#1 bobber205

bobber205
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 02 September 2006 - 01:14 AM

I want to create a database of images. I would love to be able to upload images (maybe links) I find while surfing the net while at school. I am often not allowed to use anything but a browser so a page where I could do what I want would be cool (and a good way to get started with mySQL).

Advice greatly appreciated. I have several years of casual programming experience, if that makes a difference in links.. :D

Thanks.

#2 bob_the _builder

bob_the _builder
  • Members
  • PipPipPip
  • Advanced Member
  • 207 posts

Posted 02 September 2006 - 01:33 AM

Hi,

Create table stuctures to hold the data you would like to hold

CREATE TABLE links (
  link_id int(5) NOT NULL auto_increment,
  link_name varchar(50) NOT NULL default '',
  notes text NOT NULL default '',
  PRIMARY KEY (link_id)
) TYPE=MyISAM;

Then use forms to post the data


// Connection details somewhere

if isset($_POST['submit']) {

		$sql = mysql_query("INSERT INTO links (link_name, notes) VALUES ('".$_POST['links'].", ".$_POST['notes']."')");
		echo '<br />URL successfully added';

}else{

echo '<form id="form" name="links" method="post" action="">
  		<input type="text" name="textfield" />
  		<br /><br />
  		<textarea name="" cols="" rows=""></textarea>
  		<br /><br />
  		<input name="submit" type="submit" value="submit" />
	  </form>';
}

Only budget concept ..

You will need to use 'multipart/form-data' for images/files, store the image names + extension in the database and the images in a folder on your server

hth




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users