CurtisKenny
21-03-2009, 10:54 PM
Ok before i begin, im very new at php and dont flame me if i've done something stupidly wrong...
Basically, im in charge of the website for new community radio station Bolton FM and need a php script to say the on air DJ (before i go any further, please DO NOT suggest a dj panel to me).
I want to hook this php script up to a database with the tables "Mon", "Tue", etc with the columns "Showbegin", "Showend" and "Presenter" to pull up the current presenter.
Here is my code:
<?php
$query = "SELECT showbegin, showend, presenter
FROM date('D')
WHERE showbegin < curtime('G:i')
AND showend > curtime('G;i')";
$result = mysql_query($query);
if (!$result) {
//do error processing (log error, etc)
echo "query failure!".mysql_error();
die();
}
$showInfo = mysql_fetch_assoc($result); ?>
<div class="show">
<p>Currently airing: <?php echo $showInfo['presenter'] ?></p>
(i have my connection info at the top of the page, so no, it isnt missing)
I get the error
query failure!You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '() WHERE showbegin < time(G:i) AND showend > time(G:i)' at line 2
Could anyone please suggest something?
As i said, please be patient with me, im a bit inexperienced in php...
Moved by ReviewDude (Forum Moderator) from "Web Design", as this is an issue related to PHP code, not its use within design.
Basically, im in charge of the website for new community radio station Bolton FM and need a php script to say the on air DJ (before i go any further, please DO NOT suggest a dj panel to me).
I want to hook this php script up to a database with the tables "Mon", "Tue", etc with the columns "Showbegin", "Showend" and "Presenter" to pull up the current presenter.
Here is my code:
<?php
$query = "SELECT showbegin, showend, presenter
FROM date('D')
WHERE showbegin < curtime('G:i')
AND showend > curtime('G;i')";
$result = mysql_query($query);
if (!$result) {
//do error processing (log error, etc)
echo "query failure!".mysql_error();
die();
}
$showInfo = mysql_fetch_assoc($result); ?>
<div class="show">
<p>Currently airing: <?php echo $showInfo['presenter'] ?></p>
(i have my connection info at the top of the page, so no, it isnt missing)
I get the error
query failure!You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '() WHERE showbegin < time(G:i) AND showend > time(G:i)' at line 2
Could anyone please suggest something?
As i said, please be patient with me, im a bit inexperienced in php...
Moved by ReviewDude (Forum Moderator) from "Web Design", as this is an issue related to PHP code, not its use within design.