b3ta.com qotw
You are not logged in. Login or Signup
Home » Question of the Week » Off Topic » Post 538558 | Search
This is a question Off Topic

Are you a QOTWer? Do you want to start a thread that isn't a direct answer to the current QOTW? Then this place, gentle poster, is your friend.

(, Sun 1 Apr 2001, 1:00)
Pages: Latest, 837, 836, 835, 834, 833, ... 1

« Go Back | See The Full Thread

Where
will that information be held?

Is there a backend MySQL db?
(, Tue 13 Oct 2009, 17:21, 1 reply, 16 years ago)
Hopefully in a flat CSV file.
I'm not above storing all the schedule and now playing info as images, and having it display that content.

I can get it to do it at random via a simple PHP include and an external text document... but that's only really good for banner ads.
(, Tue 13 Oct 2009, 17:23, Reply)
Something...
like this would do it if it were in a simple table in a MySQL database (which tbh, is probably your best bet, as that way, he could use phpmyadmin to enter the latest DJ and this script will grab the latest one, leaving the work up to him):

Have a table like this, called "dj_schedule":

"dj_schedule_id | dj | dj_image"

--code
function getLatestDJ(){

$con = mysql_connect("localhost","****","******");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("dbname", $con);
$result = mysql_query("SELECT DJ from dj_schedule order by dj_schedule_id desc limit 1");

while($row = mysql_fetch_array($result))
{
echo ("This is the next DJ: " . $row['DJ'] . "
}
}
--/code

EDIT: just as well it's not Python, all the bloody indentation has dissapeared!
(, Tue 13 Oct 2009, 17:28, Reply)
**Whimper**
I've really bitten off more than I can chew here. I've only just figured out how to install bloody WAMP.

/Edit

Thanks...
(, Tue 13 Oct 2009, 17:29, Reply)
Pity
it's not LAMP - much easier to setup and easier to use (IMO).

Seriously though, if it has a PHP interpreter, it's likely that it has MySQL or if not, you could probably install it if you have those rights.

Is it his own server? If so, this really isn't that difficult, and I'm willing to help you get it up and running.
(, Tue 13 Oct 2009, 17:32, Reply)
It's more the database problem that annoys me...
As I know precisely diddly-squat about them. Time to get learning!
(, Tue 13 Oct 2009, 19:52, Reply)
I know what you mean
I got lost around when the marquee tag stopped being cool
(, Tue 13 Oct 2009, 17:45, Reply)
I'm
not sure it ever was ;-)
(, Tue 13 Oct 2009, 17:51, Reply)
It was in the 90's
..with me
(, Tue 13 Oct 2009, 18:08, Reply)
jQuery is the new Marquee.
Except I can't see it going unpopular, I really really <3 jQuery.
(, Tue 13 Oct 2009, 18:16, Reply)
Nononononononon....NO.
Don't put the connection function into the dj function. Every time it's called, it'll create a new connection to the DB.

///// Put this in something like "lib/settings.php" /////
$settings['host'] = "localhost";
$settings['user'] = "username";
$settings['pass'] = "password";
$settings['dbname'] = "dbname";

///// Put this in your "lib/head.php" file //////

include_once('settings.php');
include_once('functions.php');
$con = mysql_connect($settings['host'],$settings['user'],$settings['pass']);
if (!$con) {die('Could not connect: ' . mysql_error());}
mysql_select_db($settings['dbname'], $con);

////// Put this in 'lib/functions.php' /////////
function getLatestDJ(){
global $con;
$result = mysql_query("SELECT DJ from dj_schedule order by dj_schedule_id desc limit 1");
$row = mysql_fetch_assoc($result);
return $row;
}

////// Put this in your front page.

include('lib/head.php');
// put this where you want.
$x = getLatestDJ();
echo "Next DJ is ".$x['DJ']." <img src=\"".$x['']."\" />";
(, Tue 13 Oct 2009, 18:15, Reply)
indeed.
but I believe he'd only need it once.

Yours is, however, far more elegant. I'd rushed mine off the top of my head to point in the right direction.
(, Tue 13 Oct 2009, 18:53, Reply)

« Go Back | See The Full Thread

Pages: Latest, 837, 836, 835, 834, 833, ... 1