# Looking for help debugging a php code

**URL:** https://forum.kirupa.com/t/looking-for-help-debugging-a-php-code/9798
**Category:** programming
**Created:** [December 18, 2002, 9:28pm UTC](https://forum.kirupa.com/t/looking-for-help-debugging-a-php-code/9798 "2002-12-18T21:28:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![upuaut](https://avatars.discourse-cdn.com/v4/letter/u/9fc348/32.png) [@upuaut](https://forum.kirupa.com/u/upuaut)
#### Post date: [December 18, 2002, 9:28pm UTC](https://forum.kirupa.com/t/looking-for-help-debugging-a-php-code/9798/1 "2002-12-18T21:28:41Z")

</div>

```php
$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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [December 19, 2002, 1:52am UTC](https://forum.kirupa.com/t/looking-for-help-debugging-a-php-code/9798/2 "2002-12-19T01:52:27Z")

</div>

```php

<?
$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
