I need a little direction. This is my goal:
- Create a large text box that allows someone to insert links, one per line, in plain text ( ex. http://www.website.com/image.jpg
- Save the data to a unique list saved on the server
- Use the list to display thumbnails of all the links on a page that can be clicked to load the actual image.
- Create a unique link so that a user can access the list they just made at a later time.
How should I go about starting this project? I have been learning some JavaScript for 3 weeks or so, but it seems that this will not work for my project? A little help? Can this be accomplished with php? What are my best options. I could really use some help. Thank you.
Someone replied to this with the following code and I am confused. My server has php and mysql set up. I have made a fresh database. I am not familar with php or MySQL yet. Does all this code just go into an html file? I could use some info/help please. Note: It would be awesome if any user could access and use this form freely. So I don’t have to worry about extra accounts or permissions.
[code]***
*PHP + MySQL.
*
*You’ll need a table called “links”, e.g.
*
CREATE TABLE links (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
uri VARCHAR(255) NOT NULL
);
*Then you’ll need some PHP
Enter one link per line <?php if (isset($_POST["links"])) { $dbh = mysql_connect("localhost", "username", "password"); mysql_select_db("dbname"); $links = $_POST["links"]; $links = explode("\n", $links); foreach ($links as $link) { $link = mysql_real_escape_string($link); $sql = "INSERT INTO links (uri) VALUES('{$link}')"; mysql_query($sql, $dbh); } } ?>
*And finally, you’ll need a page to display your links:
-
<?php
$dbh = mysql_connect("localhost", "username", "password");
mysql_select_db("dbname");
- " target="_blank"><?=$result["link"]?> <?php } ?>
$sql = “SELECT * FROM links”;
$result = mysql_query($sql, $dbh) or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
?>