Tuesday, April 12, 2005

Query to get a key value from one table that will serve as the search index in another table:

$foreign_key_query = "select `$join_key_col` FROM $key_table WHERE `$search_col` = '$search_value'";

open_db($db);

$foreign_key_result = mysql_query($foreign_key_query) or mysql_trigger_error('foreign_key_query error');
$foreign_key = mysql_result($foreign_key_result, 0, 0);

mysql_free_result($foreign_key_result);

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home