• Welcome to RadioDJ - Free Radio Automation Software Forum. Please log in or sign up.

DJ/Presenter Dynamic Profiles

Started by EmmaSts, February 16, 2020, 06:52:08 PM

EmmaSts

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
eg: https://www.xperienceradio.co.uk/profile.php?proid=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:

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

<?php
$djid 
preg_replace('#[^0-9]#i'''$_GET['djid']);
settype($djid'integer');

$sqldj mysqli_query($dbcon"SELECT * FROM `djprofiles` WHERE `djid`='$djid' LIMIT 1");
while(
$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 :)

<html>
<head>
<title><?php echo $djname?></title>
</head>
<body>

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


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 :)

EmmaS

Quote from: strawbs89 on May 14, 2020, 05:14:17 PM
could you explain more meaning is it based php my admin if so could you give steps
It's MySQL Based and I don't know how else I can explain it with any more simplicity than I have as well as giving steps.
StreamCode Studio - RadioDJ Tools / Sites / Scripts and more
https://www.streamcodestudio.com/

XperienceRewind.co.uk - 70s and 80s None Stop
https://www.xperiencerewind.co.uk/