View Single Post
  #1 (permalink)  
Old 2006-02-16, 08:56 PM
timgraham timgraham is offline
Junior Member
 
Join Date: Feb 2006
Posts: 4
timgraham
Default

Is it possible to filter a recordset using a PHP variable.
I have tried to do this below, without success. The PHP variable is created from the first recordset, then I need to filter the second recordset with the new variable. I used the Dreamweaver option "filter by server variable". Is this the way to do it ?

Thanks For reading


$colname_find_user = "-1";
if (isset($_GET['cm'])) {
$colname_find_user = (get_magic_quotes_gpc()) ? $_GET['cm'] : addslashes($_GET['cm']);
}
mysql_select_db($database_mx_shop, $mx_shop);
$query_find_user = sprintf("SELECT * FROM order_ord WHERE id_ord = '%s'", $colname_find_user);
$find_user = mysql_query($query_find_user, $mx_shop) or die(mysql_error());
$row_find_user = mysql_fetch_assoc($find_user);
$totalRows_find_user = mysql_num_rows($find_user);

$user_id = $row_find_user['userid_ord'];

$colname_old_credits = "-1";
if (isset($_SERVER['$user_id'])) {
$colname_old_credits = (get_magic_quotes_gpc()) ? $_SERVER['$user_id'] : addslashes($_SERVER['$user_id']);
}
mysql_select_db($database_connblog, $connblog);
$query_old_credits = sprintf("SELECT * FROM tbl_users WHERE int_user_id = %s", $colname_old_credits);
$old_credits = mysql_query($query_old_credits, $connblog) or die(mysql_error());
$row_old_credits = mysql_fetch_assoc($old_credits);
$totalRows_old_credits = mysql_num_rows($old_credits);
Reply With Quote