Looking for help debugging a php code

$hookup=mysql_connect($sr, $nm, $pw) or die ("Error loading requested data");
mysql_select_db($db,$hookup);
$result = mysql_query("SELECT * FROM $tn",$hookup);
$numrows=mysql_num_rows($result);
$numrows = $numrows-1;

//Search for match
$counter=0;
do(
	$name=(mysql_result($result , $counter , "ename"));
	++$counter;
}
while ($search != $name && $counter<=$numrows);

//define match variable and find the match
$match=$counter-1;
$cypher=(mysql_result($result,$match,"cypher"));
$status=(mysql_result($result,$match,"status"));
//password does not match the cypher val in the table.
if($pass!=$cypher){
	$status="incorrect";
}
//name is not in db
if($search != $name){
	$status="name not found";
}

//change to flash friendly format
$status="status=$status";
echo "$status";
?>

I’m getting an error in line 16 which is

$name=(mysql_result($result , $counter , “ename”));

from the do statement. Mind you there might be other errors as well. Please any help would be greatly appreciated.


<?
$hookup=mysql_connect($sr, $nm, $pw) or die ("Error loading requested data");
mysql_select_db($db,$hookup);
$result = mysql_query("SELECT * FROM $tn WHERE ename='$name'",$hookup);

if(mysql_num_rows($result) > 0)
{
	$row = mysql_fetch_array($result);
	if($row["cypher"] == $pass)
		$status = "correct";
	else
		$status = "incorrect";
}
else
	$status = "name not found";

$status="status=$status";
echo "$status";
?>

I haven’t complied it or tested it but it should work