Hiiii there, I was wondering if someone could help me with the below, I need to pull the output from my 'Now Playing' script over to a database so it will query an artists database...
Now Playing Code as follows:
<?php
$myFile = "NowPlaying/citybeat.txt";
$fh = fopen($myFile, 'r');
$thedata = fgets($fh);
fclose($fh);
$thedata = preg_split('/\s{2,}/ ',$thedata);
$Artist = ucwords(strtolower(str_replace('_',' ',$thedata[0])));
$Title = ucwords(strtolower(str_replace('_',' ',$thedata[1])));
if((trim($artist, 2) == "") && (trim($Title, 2) == ""))
{
echo "Citybeat 96.7FM";
}
else
{
echo $Artist." - ".$Title;
}
?>
I need to pull the $Artist value into a MySQL query as follows: - I need WHERE artistname LIKE to pull the artist name, how plausible is this?
<?
if ($id == "") {
$sql="SELECT * FROM artists WHERE artistname LIKE '" . $_GET["letter"] . "%' ORDER BY artistname ASC";
$result=mysql_query($sql);
$ncount=0;
while ($myrow=mysql_fetch_array($result)) {
if ($ncount<100)
{
$ncount=$ncount+1;
$artistbody = str_replace("\'", "'", $artistbody);
?>
Hope you can help :-),
Andy