Jump to content

Getting value from MySQL Table and echoing


Ptsface12

Recommended Posts

Hello,

I am trying to get a value from a MYSQL table, and echo it. It is a shopping cart, then tells you how much you have spent. Most other scripts have done, but I'm having some trouble getting the value back.

 

Here's the code where I need it inserted:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RC-Chemicals - <?php echo $title ?></title>
<!--css -->
<link href="./css/style.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="./fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<!--js -->
<script type="text/javascript" src="./js/jquery.js"></script>
<script type="text/javascript" src="./js/chili-1.7.pack.js"></script>
<script type="text/javascript" src="./js/jquery.cycle.all.2.72.js"></script>
<script type="text/javascript" src="./js/cufon-yui.js"></script>
<script type="text/javascript" src="./js/sansation.js"></script>
<script type="text/javascript" src="./js/carusel.js"></script>
<script type="text/javascript" src="./js/script.js"></script>
<script type="text/javascript" src="./js/functions.js"></script>
<script type="text/javascript" src="./js/jquery.sudoSlider.js"></script>
<script type="text/javascript" src="./fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="./fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"/></head>
<body>
<div id="wrapper">
  <div id="header"> <a href="index.php"><img src="./images/logo.png" alt="" id="logo" /></a>
    <div class="right_header">
      <div class="cart-box">
        <div class="cart-left"></div>
<?php
        if (!isset($_SESSION['user'])) {
    echo "<div class=\"cart-content\">
          <ul>
            <li><a href=\"#\">00 item</a></li>
             <li><a href=\"#\"><span>50.00</span></a></li>
          </ul>
        </div>
        <div class=\"cart-right\"></div>
      </div>";
}
else {
echo "<div class=\"cart-content\">
          <ul>
         
            <li>Please login to purchase.</li>
          </ul>
        </div>
        <div class=\"cart-right\"></div>
      </div>";
}
?>
      <div class="account_login">
        <ul>
         
          <li><a href="login.php">Login </a></li>
        </ul>
      </div>
      <div class="search_field">
        <input type="text" value="Enter keywords to search" onfocus="if(this.value == 'Enter keywords to search') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'Enter keywords to search'; }" />
        <a href="#">Search</a> </div>
    </div>
    <div id="nav">
      <ul>
        <li><a href="#">Methoxetamine</a></li>
        <li><a href="#" class="active">Products</a>
          <ul>
            <li>MDAI</li>
            <li><a href="#">Methoxetamine</a></li>
            <li><a href="#">Methiopropamine</a></li>
            <li><a href="#">NRG-3</a></li>
            <li><a href="#">AMT</a></li>
            <li><a href="#">5-APB</a></li>
            <li><a href="#">Benzo Fury Pellets)</a></li>
          </ul>
        </li>
        
        <li><a href="#">Contact</a></li>
        <li><a href="#">Forums</a></li>
        
         
    </div>
    <br class="clear" />
  </div>

 

<div id="wrapper">
  <div id="header"> <a href="index.php"><img src="./images/logo.png" alt="" id="logo" /></a>
    <div class="right_header">
      <div class="cart-box">
        <div class="cart-left"></div>
<?php
        if (!isset($_SESSION['user'])) {
    echo "<div class=\"cart-content\">
          <ul>
            <li><a href=\"#\">00 item</a></li>
             <li><a href=\"#\"><span>50.00</span></a></li>
          </ul>
        </div>
        <div class=\"cart-right\"></div>
      </div>";
}
else {
echo "<div class=\"cart-content\">
          <ul>
         
            <li>Please login to purchase.</li>
          </ul>
        </div>
        <div class=\"cart-right\"></div>
      </div>";
}
?>

 

Extra details:

Table name: tbl_users

Column name: cart

WHERE: email='$_SESSION['user']'

 

Thank you guys very much!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.