newhip Posted February 22, 2013 Share Posted February 22, 2013 I have a basic understanding of php but there's a lot things I don't get. I made an upload form that is processed by an upload.php file. Here's the code. <?php $conn=mysql_connect("localhost","root",""); $select=mysql_select_db("project",$conn); $title=$_POST['title']; $pic=$_FILES['pic']['tmp_name']; $pic2=$_FILES['pic']['name']; $desc=$_POST['desc']; $path="upload/".$pic2; $themove=move_uploaded_file($pic,$path); $sqlqry=mysql_query("INSERT INTO media(title,pic,desct) VALUES ('$title','$path','$desc')"); $searr="SELECT * FROM media "; $seartt=mysql_query($searr); $burp=mysql_fetch_array($seartt); $ab=mysql_query($_REQUEST['desct']); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Uploaded Page</title> </head> <body> <a href="#"><h1><?php echo $burp['title']; ?></h1></a><br /><br /> <img src="<?php echo $burp['pic']; ?>" /><br /><p><br /><?php echo $burp['desct']; ?></p> </body> </html> I'm trying to request the different pages in the url for the things that are inputted in my table. Can anyone help me understand. or even remotely understand what i'm trying to do. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 22, 2013 Share Posted February 22, 2013 1. Post in the right forum next time please. I'm moving this. 2. Use code tags so we can read your code. 3. Your select query is getting ALL the rows in your table, except you only run it once so it gets the first one every time. use mysql_insert_id. Quote Link to comment Share on other sites More sharing options...
newhip Posted February 22, 2013 Author Share Posted February 22, 2013 Sry i dont really understand what you mean Quote Link to comment Share on other sites More sharing options...
newhip Posted February 22, 2013 Author Share Posted February 22, 2013 wow nvm I get it thx Quote Link to comment Share on other sites More sharing options...
newhip Posted February 22, 2013 Author Share Posted February 22, 2013 Ok I'm still having some trouble. Now its echoing out the last thing input in my database and i know what the id is but how do i now reference that in my url? It might be basic stuff but i dont get it. Can anyone help? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.