My sql script is not returning a value 'sid' when I use it with php, but when I run it against the actual database it returns the value. I cannot figure out where my error is. My tables are as follows:
Song
aid (1)
sid (999)
title (Moonlight Sonata)
surl
Album
aid (1)
artist (Beethoven)
genre (Classic)
album
Here is my code:
$sql="SELECT S.title, S.surl, S.sid, A.aid, A.album, A.artist FROM challenge C,
song S, album A WHERE C.fid = '$uid' AND uid = '$user' AND date = '$date'
AND C.sid = S.sid AND S.aid = A.aid";
$result=mysql_query($sql);
if (mysql_num_rows($result) != 0){
while($row=mysql_fetch_array($result)){
$title = $row[title];
$album = $row[album];
$surl = $row[surl];
$artist = $row[artist];
$aid = $row[aid];
$sid = $row[sid];
echo "Album: $album Artist: $artist Title: $title Song: $surl SongID: $sid";
}
}
Everything is printing except the value 'sid' - it should be printing 999. Any help would be greatly appreciated!!