Hi there,
Can someone help me figure out how to pull the data out of MySQL database baed on the customer_id. Currently i only have two users but they both see the same information but each have their own unique customer_id.
<?php
require_once('Connections/my_conn.php');
require('includes/application_top.php');
// if the customer is not logged on, redirect them to the login page
if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
/// action write here
$sess_id=session_id();
if(isset($HTTP_SESSION_VARS['customer_id']))
$customer_id=$HTTP_SESSION_VARS['customer_id'];
?>
<?php
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($HTTP_GET_VARS['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $HTTP_GET_VARS['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$customers_id_Recordset1 =$HTTP_SESSION_VARS['customer_id'];
if (isset($HTTP_SESSION_VARS['customers_id'])) {
$customers_id_Recordset1 = (get_magic_quotes_gpc()) ? $HTTP_SESSION_VARS['customers_id'] : addslashes($HTTP_SESSION_VARS['customers_id']);
}
mysql_select_db($database_my_conn, $my_conn);
$query_Recordset1 = sprintf("SELECT first_name, last_name, city FROM card_schedule WHERE %s = %s", $customers_id_Recordset1,$customers_id_Recordset1);
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $my_conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($HTTP_GET_VARS['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $HTTP_GET_VARS['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<?php
// the following cPath references come from application_top.php
$category_depth = 'top';
if (isset($cPath) && tep_not_null($cPath)) {
$categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
$cateqories_products = tep_db_fetch_array($categories_products_query);
if ($cateqories_products['total'] > 0) {
$category_depth = 'products'; // display products
} else {
$category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
$category_parent = tep_db_fetch_array($category_parent_query);
if ($category_parent['total'] > 0) {
$category_depth = 'nested'; // navigate through the categories
} else {
$category_depth = 'products'; // category has no products, but display the 'no products' message
}
}
}
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CARD_SCHEDULE_SETUP);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<!--<link rel="stylesheet" type="text/css" href="stylesheet.css">-->
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<tr>
<td width="182" align="left" valign="top">
<table width="182" cellpadding="0" cellspacing="0" border="0">
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
</table>
</td>
<td width="509" valign="top" style="padding-left:2px;">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" height="100%" valign="top" bgcolor="#FFFFFF">
<table border="0" width="100%" cellpadding="0" cellspacing="0" >
<tr>
<td width="100%" height="25" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" height="24">
<tr>
<td><img src="images/left_header.gif" width="4" height="24" alt="" /></td>
<td width="100%" style="background-image:url(images/header_bg.gif); text-align:left; color:#FFF; padding-left:5px; font-size:110%; font-weight:bold "><?php
echo HEADING_TITLE; ?>
</td>
<td><img src="images/right_header.gif" width="4" height="24" alt="" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" valign="top" height="369" style="padding:20px; " class="infoBox"><?php echo TEXT_INFORMATION; ?>
<?php do { ?>
<p><?php echo $row_Recordset1['first_name']; ?> | <?php echo $row_Recordset1['last_name']; ?> | <?php echo $row_Recordset1['city']; ?></p>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>