Jump to content

Archived

This topic is now archived and is closed to further replies.

bobber205

My First Database! -- Images

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Hi,

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

[code]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;[/code]

Then use forms to post the data

[code=php:0]

// 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>';
}[/code]

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.