hey
im working on a download thingy for my site, and people can submit downloads, and mirrors for that download

this is the code for the submit download, i have 2 tables, i "downloads" which stores the main download stuff, then "mirrors" where the urls are stored. in mirrors theres a column called "did", which holds the download id from "downloads", which that number is autoincrement.

im trying to get that number after i insert it into the DB, and it isn't working..any ideas?

thanks


PHP Code:
$db mysql_connect("localhost""fragblast""");
            
mysql_select_db("fragblast",$db);
            
            
$review=str_replace("\n","<br>",$describ);
                
            
$sql "INSERT INTO download (title, auth_id, auth_name, describ, size, cat) VALUES ('$title', '$userid', '$username', '$describ', '$size', '$cat')";
            
$result mysql_query($sql);


            
$sql="SELECT * FROM download WHERE title='$title' AND auth_id='$userid' AND auth_name='$username' AND describ='$describ' AND size='$size' AND cat='$cat')";
            
$result=mysql_query($sql);

            while (
$row mysql_fetch_array($result)) { //LINE 49
                
echo $row['id'];    //debug
                
$id=$row['id'];

                
$sql "INSERT INTO mirrors (did,site,name) VALUES ('$id', '$mirrorname', '$url')";
                
$result mysql_query($sql);

                
$sql "UPDATE stats SET count = count + 1 WHERE name='$cat'";
                
$resultmysql_query($sql);
            } 

the error is:
Warning: Supplied argument is not a valid MySQL result resource in C:\Inetpub\wwwroot\downloads\add.php on line 49