zr2bic Posted April 12, 2010 Share Posted April 12, 2010 I am building a football pool website. When a user registers, I am having them pick their favoroite football team to have a team logo show on the main page next to their name. More like an avatar if you will. I have all the teams names in a table on MySQL which is bound dynamically via a drop down menu and all team logos on the server. How can I create the link between the team they pick and the associated logo image? Exmple, if they pick the Dallas Cowboys, I want the Cowboys logo to show up next to their name. Is there an easy way to do this? My site is www.zr2bic.com/sp10/index.php Link to comment https://forums.phpfreaks.com/topic/198308-linking-images-to-a-mysql-field/ Share on other sites More sharing options...
Ken2k7 Posted April 12, 2010 Share Posted April 12, 2010 Each dropdown menu can link to a page with a query string parameter that specifies which team is being displayed. Then just grab that value and query the DB for the image. Link to comment https://forums.phpfreaks.com/topic/198308-linking-images-to-a-mysql-field/#findComment-1040530 Share on other sites More sharing options...
zr2bic Posted April 12, 2010 Author Share Posted April 12, 2010 I am very new to PHP and MySQL... and am suprised I've got as far as I have. I undersdtand what you are saying, but not exactly sure how to write the code. I have inserted a "Master Detail Page Set" via dreamweaver, so when people register, it automatiaclly builds "their" table. Is there an example or a tutorial you know of that I can follow or manipulate? Link to comment https://forums.phpfreaks.com/topic/198308-linking-images-to-a-mysql-field/#findComment-1040568 Share on other sites More sharing options...
Ken2k7 Posted April 12, 2010 Share Posted April 12, 2010 Sorry, not really. I don't use Dreamweaver as it is crap. Much easier to just write it yourself. Link to comment https://forums.phpfreaks.com/topic/198308-linking-images-to-a-mysql-field/#findComment-1040590 Share on other sites More sharing options...
wordman Posted April 13, 2010 Share Posted April 13, 2010 Z, He's right, manual coding is the best way to learn. I use DW but mostly just for a quick visual check, I rarely ever use the features it offers. Anyhow, here's an example of a query string: a href="webpage.php?ti=10 Just add a question mark after the end of the page name and add a variable as shown above. Your next page would have something similar to this in the code to retrieve it: $_SERVER['QUERY_STRING']; $teamImage = $_GET['ti']; Now you can display the contents of the query string using $teamImage in your code. Multiple query strings can be linked together, but remember the url has a maximum length of 255 characters, so be careful not to tie too much together. Google query strings and you'll find all the right info. Hope it helps! Cheers, wordman Link to comment https://forums.phpfreaks.com/topic/198308-linking-images-to-a-mysql-field/#findComment-1040639 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.