Firstly you need a table in your database, for this tutorial our database is called djprofiles.
In the structure of our database: djid, name, bio, imgpath
Creating the table:
CREATE TABLE `djprofiles` (`djid` int(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY, `name` varchar(255) NOT NULL, `bio` text NOT NULL, `imgpath` varchar(255) NOT NULL)
A row in the database with a DJ is like this: 1 - SteveAlmighty - The one who you listen to when you're bored - djpics/stevespic.jpg
With the profile page we need to GET the djid and move onto asking the database for the information...
So below we are using php to:
SELECT * (* Means EVERYTHING)
FROM `djprofiles` (The database table)
WHERE `djid`='$djid' (The DJID is equal to the profile id we get (profile.php?djid=1))
LIMIT 1 as we only want 1 return that matches.
From here we are getting all the information and put into variables so we can display what and where we need to using echo.
Save the script as "profile.php"
Then goto profile.php?djid=1
The more DJs/Presenters you have you just change the ending number.
Visit XperienceRadio DJs to see how it works, notice in the address bar when you view a profile.
You can see the same principles are applied throughout and not just for profiles, take these tutorials for eg, noticed the address bar: tutorials-php-view.php?id=6
Content by: Steve Stewart
Posted a year ago with 1044 views
Dynamic DJ/Presenter Profiles
Firstly you need a table in your database, for this tutorial our database is called djprofiles.
In the structure of our database: djid, name, bio, imgpath
Creating the table:
A row in the database with a DJ is like this:
1 - SteveAlmighty - The one who you listen to when you're bored - djpics/stevespic.jpg
With the profile page we need to GET the djid and move onto asking the database for the information...
So below we are using php to:
SELECT * (* Means EVERYTHING)
FROM `djprofiles` (The database table)
WHERE `djid`='$djid' (The DJID is equal to the profile id we get (profile.php?djid=1))
LIMIT 1 as we only want 1 return that matches.
From here we are getting all the information and put into variables so we can display what and where we need to using echo.
Save the script as "profile.php"
Then goto profile.php?djid=1
The more DJs/Presenters you have you just change the ending number.
Visit XperienceRadio DJs to see how it works, notice in the address bar when you view a profile.
You can see the same principles are applied throughout and not just for profiles, take these tutorials for eg, noticed the address bar: tutorials-php-view.php?id=6