foreverhex Posted June 26, 2006 Share Posted June 26, 2006 I've been trying to work out a script for a photo upload and I have all that down. What happens is you up load a photo it goes inside the photo folder and info is popped in the data base: Username, photo url, medium, date submitted and description. My question is how do I retrieve info from the database using something like: www.site.com/view.php?user=foreverhex&id=myfirstpic.jpgso that I can place my varibles in and the page will have all the info. Quote Link to comment https://forums.phpfreaks.com/topic/12937-mysql-send-and-get-data/ Share on other sites More sharing options...
fenway Posted June 26, 2006 Share Posted June 26, 2006 [!--quoteo(post=388077:date=Jun 26 2006, 10:55 AM:name=foreverhex)--][div class=\'quotetop\']QUOTE(foreverhex @ Jun 26 2006, 10:55 AM) [snapback]388077[/snapback][/div][div class=\'quotemain\'][!--quotec--]I've been trying to work out a script for a photo upload and I have all that down. What happens is you up load a photo it goes inside the photo folder and info is popped in the data base: Username, photo url, medium, date submitted and description. My question is how do I retrieve info from the database using something like: www.site.com/view.php?user=foreverhex&id=myfirstpic.jpgso that I can place my varibles in and the page will have all the info.[/quote]Sounds reasonable... you simply need to pass enough informtion on the query string for your view.php function to retrieve the desired result set. You would probably be better off with a uid= instead of actually passing the name of the file, so that you never end up with broken links / bookmarks. Quote Link to comment https://forums.phpfreaks.com/topic/12937-mysql-send-and-get-data/#findComment-49695 Share on other sites More sharing options...
foreverhex Posted June 26, 2006 Author Share Posted June 26, 2006 [!--quoteo(post=388092:date=Jun 26 2006, 11:32 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 26 2006, 11:32 AM) [snapback]388092[/snapback][/div][div class=\'quotemain\'][!--quotec--]Sounds reasonable... you simply need to pass enough informtion on the query string for your view.php function to retrieve the desired result set. You would probably be better off with a uid= instead of actually passing the name of the file, so that you never end up with broken links / bookmarks.[/quote]What do you mean by an uid? Im kinda new to php (working with it actively for 6months) and even newer to SQL. Quote Link to comment https://forums.phpfreaks.com/topic/12937-mysql-send-and-get-data/#findComment-49734 Share on other sites More sharing options...
fenway Posted June 26, 2006 Share Posted June 26, 2006 [!--quoteo(post=388134:date=Jun 26 2006, 01:23 PM:name=foreverhex)--][div class=\'quotetop\']QUOTE(foreverhex @ Jun 26 2006, 01:23 PM) [snapback]388134[/snapback][/div][div class=\'quotemain\'][!--quotec--]What do you mean by an uid? Im kinda new to php (working with it actively for 6months) and even newer to SQL.[/quote]I mean I'm assuming that your table has a unique identifier (UID) auto-increment column that allows you to uniquely identify each row, regardless of the name of the actual file in each row. Quote Link to comment https://forums.phpfreaks.com/topic/12937-mysql-send-and-get-data/#findComment-49745 Share on other sites More sharing options...
foreverhex Posted June 26, 2006 Author Share Posted June 26, 2006 [!--quoteo(post=388147:date=Jun 26 2006, 01:50 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 26 2006, 01:50 PM) [snapback]388147[/snapback][/div][div class=\'quotemain\'][!--quotec--]I mean I'm assuming that your table has a unique identifier (UID) auto-increment column that allows you to uniquely identify each row, regardless of the name of the actual file in each row.[/quote]Ah! I see where you're going with that. So in my photo sql table i can have a row called id and have it count up depending on the art. For ex: view.php?user=foreverhex&id=1 or id=2 the 1 (or 2)would be the first pic added so the id would pop over to the photos url during the query? Quote Link to comment https://forums.phpfreaks.com/topic/12937-mysql-send-and-get-data/#findComment-49766 Share on other sites More sharing options...
fenway Posted June 26, 2006 Share Posted June 26, 2006 [!--quoteo(post=388168:date=Jun 26 2006, 02:53 PM:name=foreverhex)--][div class=\'quotetop\']QUOTE(foreverhex @ Jun 26 2006, 02:53 PM) [snapback]388168[/snapback][/div][div class=\'quotemain\'][!--quotec--]Ah! I see where you're going with that. So in my photo sql table i can have a row called id and have it count up depending on the art. For ex: view.php?user=foreverhex&id=1 or id=2 the 1 (or 2)would be the first pic added so the id would pop over to the photos url during the query?[/quote]That's right -- you'd have an auto-increment column for that very purpose. Quote Link to comment https://forums.phpfreaks.com/topic/12937-mysql-send-and-get-data/#findComment-49775 Share on other sites More sharing options...
foreverhex Posted June 26, 2006 Author Share Posted June 26, 2006 [!--quoteo(post=388177:date=Jun 26 2006, 03:22 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 26 2006, 03:22 PM) [snapback]388177[/snapback][/div][div class=\'quotemain\'][!--quotec--]That's right -- you'd have an auto-increment column for that very purpose.[/quote]Thanks for your help. i find it easier to figure things out when I talk or type about them. Thx. Quote Link to comment https://forums.phpfreaks.com/topic/12937-mysql-send-and-get-data/#findComment-49789 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.