Ok, I am having trouble making a Search script for my database, I need a script that allows vistors to input a usersname into a form, hit submit, and then view that specific users data. One of my problems was that i have 3 diferent user tables:
mau_users
clan_users
omni_users
after the script searched the 3 databases, it would display the following things from each match it found:
first_name
char_name
email
icq
aol
msn
yahoo
my theory was to have them ut the name into the text box of a form, and hit submit. upon hitting submit it would send there text to the search script. The name of the text box is user.
Here is the script that i had written, but when i run it i receive Couldnt Execute Query.
<?
$db_name = "dbxxxx";
$connection = @mysql_connect("localhost", "usernamexxxx", "passxxxx") or die("Couldn't connect.");
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select database.");
$sql = "SELECT first_name, char_name, email, icq, aol, msn, yahoo FROM omni_users, clan_users, mau_users WHERE char_name = \"$user\" ORDER BY char_name DESC";
$result = @($sql,$connection) or die("Couldn't execute query.");
while ($row = mysql_fetch_array($result)) {
$first_name = $row['first_name'];
$char_name = $row['char_name'];
$icq = $row['icq'];
$email = $row['email'];
$aol = $row['aol'];
$msn = $row['msn'];
$yahoo = $row['yahoo'];
}
?>
Can someone show me how i would make this script so that it actually works?