Ok well I've been having problems with my php/sql database, but I've tracked it down to the if statement, so I know it has nothing to do with the SQL queries. I wrote a snippet of code that is doing basicaly the same thing, but altered the if statement to just echo something instead of what I was intending it to do for debugging principles. Basicaly the script parses a tab delimited text file into 7 variables and runs a check against the SQL database to see if the $name variable matches any records in the database. If it does it will out put "$name exists in database" which works just fine. The problem is, the else if statement will not output anything at all. I've tryed changing it to a else statement, but it does not trigger either after failing the if statement. Anyone have a clue what's going on?!
while ($userinfo = fscanf ($handle, " %[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\n]\n")){
list ($name, $team, $country, $nodes_processed, $jobs_accepted, $jobs_processed, $cpu_time) = $userinfo;
$check = @mssql_query("SELECT name FROM index WHERE name LIKE '$name'");
while ($row = @mssql_fetch_array($check)) {
if ($row[0] == "$name"){
echo "$name exists in database<br>";
}
else if ($row[0] != "$name") {
echo "$name does not exist in database<br>";
}
}
}