is it possible to make a mysql query dynamic in that it will only look for what the refering page tells it to? i imagine it should, but i can't get it to work.
submitted for your approval:
$clientLogin is a single textbox that is passed to clientLogin.php via index.php and is then broken into two parts. i havn't really tested this part yet, but to the untrained eye it looks like it'd work fine. the problem is how below in the query i want to dynamically insert the info passed to this page. to test i have two entries in my database, and if i manually put in my search criteria it will work fine, but that's as far as i've gotten.
i'm really quite new at both php and sql so i appologize for being thick, but i'm usually pretty good at figuring this kind of thing out.PHP Code:// login info broken down into useful chunks, the user and their domain
$clientLogin = strtolower($clientLogin);
$clientLoginArray = explode(".", $clientLogin);
$clientLoginArray[0] = $clientUser;
$clientDomain = $clientLoginArray[1] . $clientLoginArray[2];
$clientUser = trim($clientUser);
$clientDomain = trim($clientDomain);
// database connetion variables
$host = "localhost";
$user = "root";
// $password = "";
$dbName = "clientData";
$dbTable = "clientInfo";
$link = mysql_connect ($host, $user, $password);
$query = "SELECT * from $dbTable WHERE user = '$clientUser' AND domain = '$clientDomain'";
$result = mysql_db_query($dbName, $query, $link);
while ($row = mysql_fetch_array($result)) {
print("$row[user]<br>");
print("$row[domain]<br>");
}
mysql_close ($link)





i am quite pleased with myself. mostly, anyway. as it turns out there was some stupid error in the processing of the $clientLogin variable. if you look at the way i handle $clientUser you'll see i've got the expression set up backwards. a common mistake for me that i always seem to catch quicky, but i missed it this time. here is my revised clientLogin.php complete with a tiny bit of error control:
Bookmarks