Jump to content


Photo

MySQL send and get data


  • Please log in to reply
6 replies to this topic

#1 foreverhex

foreverhex
  • Members
  • PipPipPip
  • Advanced Member
  • 91 posts

Posted 26 June 2006 - 02:55 PM

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.

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 26 June 2006 - 03:32 PM

[!--quoteo(post=388077:date=Jun 26 2006, 10:55 AM:name=foreverhex)--][div class=\'quotetop\']QUOTE(foreverhex @ Jun 26 2006, 10:55 AM) View Post[/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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 foreverhex

foreverhex
  • Members
  • PipPipPip
  • Advanced Member
  • 91 posts

Posted 26 June 2006 - 05:23 PM

[!--quoteo(post=388092:date=Jun 26 2006, 11:32 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 26 2006, 11:32 AM) View Post[/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.

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 26 June 2006 - 05:50 PM

[!--quoteo(post=388134:date=Jun 26 2006, 01:23 PM:name=foreverhex)--][div class=\'quotetop\']QUOTE(foreverhex @ Jun 26 2006, 01:23 PM) View Post[/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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#5 foreverhex

foreverhex
  • Members
  • PipPipPip
  • Advanced Member
  • 91 posts

Posted 26 June 2006 - 06:53 PM

[!--quoteo(post=388147:date=Jun 26 2006, 01:50 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 26 2006, 01:50 PM) View Post[/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?

#6 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 26 June 2006 - 07:22 PM

[!--quoteo(post=388168:date=Jun 26 2006, 02:53 PM:name=foreverhex)--][div class=\'quotetop\']QUOTE(foreverhex @ Jun 26 2006, 02:53 PM) View Post[/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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#7 foreverhex

foreverhex
  • Members
  • PipPipPip
  • Advanced Member
  • 91 posts

Posted 26 June 2006 - 08:03 PM

[!--quoteo(post=388177:date=Jun 26 2006, 03:22 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 26 2006, 03:22 PM) View Post[/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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users