# Did I do something wrong? GRRRR!

**URL:** https://forum.kirupa.com/t/did-i-do-something-wrong-grrrr/107578
**Category:** Uncategorized
**Created:** [April 16, 2004, 6:28pm UTC](https://forum.kirupa.com/t/did-i-do-something-wrong-grrrr/107578 "2004-04-16T18:28:03Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Germaris](https://avatars.discourse-cdn.com/v4/letter/g/8797f3/32.png) [@Germaris](https://forum.kirupa.com/u/Germaris)
#### Post date: [April 16, 2004, 6:28pm UTC](https://forum.kirupa.com/t/did-i-do-something-wrong-grrrr/107578/1 "2004-04-16T18:28:03Z")

</div>

I’m building a simple Flash Search Engine communicating with a MySQL DB via PHP.

To make it simple and for testing purposes, the goal is, when entering the Name of a person, to obtain his/her address.

The .swf content is:  
-an Input Text Field (Instance Name = sName, variable = snom).  
-a Dynamic Text Field among many other (Instance Name = fStreet, variable = rue) where the result is displayed.  
-a Search Button which action is described below.

Access and echo of the MySQL DB have been tested via a PHP Script and everything is A OK.

But from the .swf the Search isn’t working!  
So, what did I do wrong?

Many thanks in advance for your comments and corrections. ;-)))

Search Button ActionScript:  
on (release) {  
\_ var mySearch = new LoadVars();  
\_ mySearch.snom = sName.text;  
\_ //snom is the Variable name of the text entered by User in the Input Search Field which name is sName  
\_ var myResult = new LoadVars();  
\_ myResult.onLoad = function(success) {  
\_\_\_\_\_\_if (success) {  
\_\_\_\_\_\_\_\_\_fStreet.text = myResult.rue;  
\_ \_ \_ \_ \_//rue (which stands for “street” in French) is the Variable name of the text returned by the Server which should be displayed in the Dynamic Text Field named fStreet  
\_\_\_\_\_\_}  
\_\_\_};  
\_\_\_mySearch.sendAndLoad(“search.php”, myResult, ‘POST’);  
}

PHP Script:  
\<?php  
$host = “localhost”;  
$user = “xxxx”;  
$pass = “xxxxxxxxx”;  
$db = “xxx”;  
$table = “xxxx”;  
mysql\_connect(’$host’,’$user’,’$pass’) or die("cannot connect " .mysql\_error());  
mysql\_select\_db(’$db’) or die("cannot select db ".mysql\_error());  
$nom = $\_POST[‘snom’];  
$result = mysql\_query(“SELECT ‘street’ FROM $table WHERE ‘lastName’ like ‘$nom’”) or die ("select error " . mysql\_error());  
if ($row = mysql\_fetch\_array($result));  
print  
“&rue={$row[‘street’]}”;  
else  
print “status=name not found”;  
?\>
