Jump to content

My First Database! -- Images


bobber205

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.
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.