Jump to content

MySQL send and get data


foreverhex

Recommended Posts

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.jpg

so that I can place my varibles in and the page will have all the info.
Link to comment
Share on other sites

[!--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.jpg

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

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

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

[!--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?
Link to comment
Share on other sites

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

[!--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.
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.