Ok, I don't know why I'm getting this warning because I've ran the sql query in MySQL and it works fine. All I'm trying to do is get some information from my database and output as xml.
Here's the warning--
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\inetpub\DM Center\Version 0_2\PHP Scripts\tracklisting.php on line 10
Here's my php code
<?
include_once("config.php");
$artistName = $_GET['artistName'];
//create sql statement to get artists
$sql = 'select a.ArtistName, b.TrackTitle, b.DateReleased, b.TrackLength from recording_artist a, tracks b where a.ArtistName ='.$artistName.' and b.ArtistID = a.ArtistID LIMIT 0, 30';
$result = mysql_query($sql);
echo $result;
$num_results = mysql_num_rows($result);
echo '<?xml version="1.0" encoding="iso-8859-1"?>';
echo '<trackListing>';
for($i=0; $i<$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo '<attributes>';
echo '<tracks>';
echo stripslashes($row['a.ArtistName']);
echo stripslashes($row['b.TrackTitle']);
echo stripslashes($row['b.DateReleased']);
echo stripslashes($row['b.TrackLength']);
echo '</tracks>';
echo '</attributes>';
}
echo '</trackListing>';
?>
Does anyone know why I keep getting that warning?