RadioDJ - Free Radio Automation Software Forum

DJ/Presenter Dynamic Profiles


DJ/Presenter Dynamic Profiles
« on: February 16, 2020, 06:52:08 PM »
Hello all,
Here's a little tutorial on how to have a DJ/Presenter Profile for your website using php and MySQL.

Firstly you need a table in your database, call it anything you like but we're going to call it djprofiles for this tutorial.
In the table we are going to have djid, name, bio, imgpath fields.

So for eg: 1 - SteveAlmighty - The one who you listen to when you're bored - djpics/stevespic.jpg (Remember to have the 'djpics' folder on your server for dj pictures)

Think of php and MySQLi as a conversation where your asking a question so for example someone clicks on Steve's profile page which would be, profile.php?djid=1

Firstly in your profile page you need to get the djid and move onto asking the database for the information...
So below we are using php to:

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 putting into variables so we can display what and where we need to using echo.

Code: [Select]

$sqldj mysqli_query($dbcon"SELECT * FROM `djprofiles` WHERE `djid`='$djid' LIMIT 1");
$row mysqli_fetch_array($sqldj)){
$djname $row["name"];
$djbio $row["bio"];
$djimg $row["imgpath"];

Now you've got the info into variables, echo out in your webpage :)

Code: [Select]
<title><?php echo $djname?></title>

<h1><?php echo $djname?>'s Profile</h1>
<p><?php echo $djbio?></p>
<img src="<?php echo $djimg?>" style="min-height:220px;max-height:240px;" />

Basic and simple to get you started on php dynamics for creating a dj profile page...
Add more and play to learn...
Hope this helps some of you :)
« Last Edit: February 17, 2020, 11:29:30 PM by EmmaSts »