kempo Posted May 11, 2007 Share Posted May 11, 2007 hey, i have a database with rateid, bandid and a rating, how can i like each bandid to different pages, so bandid 1 will link to bandid 1's profile page and bandid 2 will link to bandid 2's profile page. any ideas?! Quote Link to comment https://forums.phpfreaks.com/topic/50933-link-entry-in-mysql-database-to-its-own-page/ Share on other sites More sharing options...
Psycho Posted May 11, 2007 Share Posted May 11, 2007 Hmmmm, not sure what you are getting at. Since you have data in the database, I would think that the band profile pages would be created dynamically. So, you would first want to create the viewProfile page which would use a variable on the query string to determine the id of the band who's profile is to be displayed. Then if you had a page where you wanted to link to all the bands' profile pages you just create links int he format http: //mydomain.com?bandid=nn (where nn is the band id). Quote Link to comment https://forums.phpfreaks.com/topic/50933-link-entry-in-mysql-database-to-its-own-page/#findComment-250525 Share on other sites More sharing options...
kempo Posted May 11, 2007 Author Share Posted May 11, 2007 basically ive built a little voting system which shows the results like this www.fearlessclothing.co.uk/votes.php. i cant figure out how to make band one, band two and band three a link to their profile page Quote Link to comment https://forums.phpfreaks.com/topic/50933-link-entry-in-mysql-database-to-its-own-page/#findComment-250529 Share on other sites More sharing options...
Psycho Posted May 11, 2007 Share Posted May 11, 2007 You are not providing any relevant information. I gave you a general idea on how it could be accomplished. But, I have no knowledge over how your current setup is. Are the band profile pages static or created dynamicall. If they are static, you need to create a column in the band table to specify their profile page. If they are dynamic please specify the format of the URL to access the band profile pages. Then, you also need to post the code you have to create the page above and we can help you further. Quote Link to comment https://forums.phpfreaks.com/topic/50933-link-entry-in-mysql-database-to-its-own-page/#findComment-250545 Share on other sites More sharing options...
kempo Posted May 11, 2007 Author Share Posted May 11, 2007 i havent built the band pages yet, but they will be made to an adress like www.mydomain.com/bandone.php at the moment i have one mysql database for voting with rateid, bandid and rating at the moment the bandid is litterally just what i type in, i suppose i want it so the band id is relevant to their profile page, so for exaple band ones profile page has all their information on it and an option to vote for them, if you for them their rating goes up 1, the ratings are viewable on their own page which will be something like www.mydomain.com/chart.php i want the chart to know who band one is and have an available link back to their profile page. im new at php and mysql so this is how i have to explain in order to not confuse myself! i cant show u any band profiles cos i havent built them yet because i need to figure this out first! the only thing ive built so far is a mysql database with those rows, a button that you can vote with and voting result page Quote Link to comment https://forums.phpfreaks.com/topic/50933-link-entry-in-mysql-database-to-its-own-page/#findComment-250550 Share on other sites More sharing options...
Psycho Posted May 11, 2007 Share Posted May 11, 2007 You need to take a step back. It seems you create a table for voting, but haven't created any of the other tables yet. The voting table would be the least important. IMHO, You need to start be deciding on all of the information you plan to collect - then create your database design. Now, on the band profile pages if the layout of all the pages will be the same (i.e. band name, genre of band, albums of the band, etc.) then all this information should be stored in the database and you should display the pages dynamically - i.e. get the data from the db and build the page with that data. If the pages will be significantly different, you can either build static pages for each OR store all of the page content in the database. i would definitely try to use a solution where the data is in the database as it creates less work going forward. Ok, so let's assume you will have static pages (not my preference). Then you will still need a table for the band data - band name, id, etc, and the profile page. Then when you do a query for the votes you would also grab the profile page. Something like this: SELECT COUNT(v.votes), b.band_name, b.profile_page FROM votes v LEFT JOIN bands b ON v.bandid = b.bandid GROUP BY v.votes But, if you were to use dynamic pages for the profiles, then you would do the same as above, but you would add the bandid to the list of fields to get instead of profile_page. Quote Link to comment https://forums.phpfreaks.com/topic/50933-link-entry-in-mysql-database-to-its-own-page/#findComment-250557 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.