Jump to content

joinx

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Posts posted by joinx

  1. In some pages it is being displayed but some i get this error:

     

    Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in C:\Apache2.2\htdocs\Jacey\order.php on line 75

     

    Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\Apache2.2\htdocs\Jacey\order.php on line 77

     

  2. I dont want a google search but within my database itself...

    So i have product like laptops, PC, printers, scanners etc and each of a specific brand like acer, sony etc...

    i'm trying to build a query but don't know how to do..

  3. here is my code but not working...always displaying 0 items in your cart.

    //Function to display num of items in cart
    function writeCart() {
    require_once('../Connections/JaceyConn.php');
    $sid = session_id();
    mysql_select_db($database_JaceyConn, $JaceyConn);
    $sqlnum = "SELECT * from cart where session_id = '$sid'";
    $num = mysql_query($sqlnum, $JaceyConn) or die(mysql_error());
    $totalRows_num = mysql_num_rows($num);
    if ($totalRows_num = 0) {
    	return '<p>You have no items in your shopping cart</p>';
    } else {
    	// Parse the cart session variable
    	return '<p align ="center">You have '.$totalRows_num.' item(s) in your shopping cart</p>';
    }
    

  4. How to format data from a database..

    I have a list of description that i retrieve form database..this is coming as a paragraph and me i want each sentence on one line...

    How should i do??

  5. I am working on a project. I have to submit it in 2 days..

    Now i got malware and when i run the pages in the browser its not loading

    i'm trying to remove the malware but can't...trying several software..

    i need to format i think but this also u can't

    rite now because of my project...

    is there any other safe browser  or server i can run my pages??

  6. me too i'm getting same error...here is my code

    <?php  
      
    
    mysql_select_db($database_JaceyConn, $JaceyConn); 
        $sql = "SELECT  product_name, product_price, product_status from
                FROM  product   
                WHERE product_id = $productId;";
    
        $result = mysql_query($sql, $JaceyConn); 
         
        while ($row_result = mysql_fetch_array($result)) { 
            
            echo $row_result['product_name']; 
        } 
         
         ?>
    

     

    where is the error?

  7. plz help...need to make that work..still hasn't find a solution...

     

    getting errors like

     

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Apache2.2\htdocs\Jacey\functions.inc.php:52) in C:\Apache2.2\htdocs\Jacey\showcart.php on line 5

     

    Warning: extract() [function.extract]: First argument should be an array in C:\Apache2.2\htdocs\Jacey\showcart.php on line 214

     

     

  8. if i remove it then i should only use the array to retrieve the data..like that

     

    while($row=mysql_fetch_array($info){

    $row['product_id'];

    .

    .

    .}

     

    i am having that problem in almost all my pages...nothing is being retrieved from the database n displayed...

     

    thnx a lot for ur help..

  9. here is the output:

     

    $query_info ="SELECT product_id, product_model, product_image, Product_name, product_price, `Description`, products_status FROM product WHERE product_id = $colname_info" string(143) "SELECT product_id, product_model, product_image, Product_name, product_price, `Description`, products_status FROM product WHERE product_id = 16" $info = mysql_query($query_info, $JaceyConn) or die(mysql_error())resource(4) of type (mysql result) $row_info= mysql_fetch_assoc($info)array(7) { ["product_id"]=> string(2) "16" ["product_model"]=> string(4) "H755" ["product_image"]=> string(39) "C:/Apache2.2/htdocs/Prod/Laptop/hp2.jpg" ["Product_name"]=> string(23) "HP Compaq Presario F755" ["product_price"]=> string(5) "50000" ["Description"]=> string(853) "Full Specifications: HP Compaq Presario F755 Brand processor : AMD Processor Class: Turion 64x2 Processor Speed: 1.9 GHz Installed Memory: 2 GB Maximum Memory: 3 GB Memory Technology: DDR II SDRAM Cache Size :1 MB Video Memory: 128 MB Hard Drive Capacity :160 GB Included Drives: DVD±RW (±R DL) / DVD-RAM / HD DVD-ROM CD Write Speed :16 X CD Rewrite Speed: 10 X CD Read Speed: 24 X DVD Read Speed: 8 X DVD Write Speed :4x (DVD±R), 2x (DVD-R DL), 2.4x (DVD+R DL) Display Size: 15.4 in Display Type :TFT active matrix Graphics Processor: Intel GMA X1300 GT Resolution :1280 x 800 pixels Battery Life: 3.0 hrs Battery Type :Lithium ion Wireless Technology :Bluetooth Modem Speed :56 Kbps Software Operating System Microsoft Windows Vista installed Warranty 1 year " ["products_status"]=> string(1) "1" } $totalRows_info = mysql_num_rows($info)int(1)

  10. ok made the changes...

    now it looks like that...

    <?php require_once('../Connections/JaceyConn.php'); ?>
    <?php
    $colname_info = (int)$_GET['product_id']
    
    mysql_select_db($database_JaceyConn, $JaceyConn);
    $query_info = sprintf("SELECT product_id, product_model, product_image, Product_name, product_price, `Description`, products_status FROM product WHERE product_id = $colname_info" );
    $info = mysql_query($query_info, $JaceyConn) or die(mysql_error());
    $row_info = mysql_fetch_assoc($info);
    $totalRows_info = mysql_num_rows($info);
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    <meta name="description" content="description"/>
    <meta name="keywords" content="keywords"/> 
    <meta name="author" content="author"/> 
    <link rel="stylesheet" type="text/css" href="bntemplate590/images590/default.css"/>
    <title>Jacey</title>
    <style type="text/css">
    <!--
    .style4 {font-size: 14pt}
    body,td,th {
    font-size: 9pt;
    }
    -->
    </style></head>
    
    <body>
    
    <div class="main">
    
    <div class="main_left">
    
    <div class="header">
    		<h1 align="center">Jacey Computers</h1>
      </div>
    
    	<div class="link_menu">
    		<a href="main.php" accesskey="1">Home</a>
    		<a href="category.php" accesskey="2">Product</a>
    		<a href="support.php" accesskey="3">Support & Help</a>
    		<a href="contact.php" accesskey="4">Contact Us</a>		</div>
    
    	<div class="content">
    		       
          
    	 <p> </p>
    	 <table border="2">
             <?php  while ($row = mysql_fetch_array($info)){ ?>
    		<?php $imageurl = $row['product_image']; ?>
    
    <tr>
    <td>
    <img src="<?php echo $imageurl;?>" />
        <?php echo $row['Product_name']."<br><font color=red>Price:</font>Rs".$row['product_price'];?>
    
    <form name="form" action="showcart.php" method="POST">
    <input name="product_id" type="hidden" value="<?php echo $row['product_id'];?>" />
    <input type="submit" value="Add To cart">
    <input type="hidden" name="MM_insert" value="form" />
    </form>
    
    </td>
    </tr>
    <?php }?>
    
       </table>
       <?php echo $row['product_id'];?>
                
      </div>
    </div>
    
    </div>
    <div class="footer"></div>
    </div>
    <br style="clear: both;" />
    
    </body>
    
    </html>
    

     

    to display from that array..we should use

    $row = mysql_fetch_array($id); is this wrong??

     

    Because some of my pages are not being displayed and not even retrieving the data from the database...

     

    what should i do?

     

  11. I have to display information about a product ...to do that i have to retrieve the id from the database..

     

    <a href="info.php?product_id=<?php echo $row['product_id'];?>">More Info</a>

     

    when the user  click on more info it goes to the info page...the product i d is being recognised

    like this

     

    http://localhost/jacey/info.php?product_id=16

     

    but nothing is being displayed in the next page..

     

    here is the code for info.php

    <?php require_once('../Connections/JaceyConn.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
    
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
    
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    }
    
    $colname_info = "-1";
    if (isset($_SERVER['product_id'])) {
      $colname_info = $_SERVER['product_id'];
    }
    mysql_select_db($database_JaceyConn, $JaceyConn);
    $query_info = sprintf("SELECT product_id, product_model, product_image, Product_name, product_price, `Description`, products_status FROM product WHERE product_id = %s", GetSQLValueString($colname_info, "int"));
    $info = mysql_query($query_info, $JaceyConn) or die(mysql_error());
    $row_info = mysql_fetch_assoc($info);
    $totalRows_info = mysql_num_rows($info);
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    <meta name="description" content="description"/>
    <meta name="keywords" content="keywords"/> 
    <meta name="author" content="author"/> 
    <link rel="stylesheet" type="text/css" href="bntemplate590/images590/default.css"/>
    <title>Jacey</title>
    <style type="text/css">
    <!--
    .style4 {font-size: 14pt}
    body,td,th {
    font-size: 9pt;
    }
    -->
    </style></head>
    
    <body>
    
    <div class="main">
    
    <div class="main_left">
    
    <div class="header">
    		<h1 align="center">Jacey Computers</h1>
      </div>
    
    	<div class="link_menu">
    		<a href="main.php" accesskey="1">Home</a>
    		<a href="category.php" accesskey="2">Product</a>
    		<a href="support.php" accesskey="3">Support & Help</a>
    		<a href="contact.php" accesskey="4">Contact Us</a>		</div>
    
    	<div class="content">
    		       
          
    	 <p> </p>
    	 <table border="2">
             <?php  while ($row = mysql_fetch_array($info)){ ?>
    		<?php $imageurl = $row['product_image']; ?>
    
    <tr>
    <td>
    <img src="<?php echo $imageurl;?>" />
        <?php echo $row['Product_name']."<br><font color=red>Price:</font>Rs".$row['product_price'];?>
    
    <form name="form" action="showcart.php" method="POST">
    <input name="product_id" type="hidden" value="<?php echo $row['product_id'];?>" />
    <input type="submit" value="Add To cart">
    <input type="hidden" name="MM_insert" value="form" />
    </form>
    
    </td>
    </tr>
    <?php }?>
    
       </table>
       <?php echo $row['product_id'];?>
                
      </div>
    </div>
    
    </div>
    <div class="footer"></div>
    </div>
    <br style="clear: both;" />
    
    </body>
    
    </html>
    

     

    I am having this same problem evrywhere..i can't add to cart also..

     

     

  12. I am doing an ecommerce website using dreamweaver cs3.

    Can i create 2 recordsets for 1 page..

    i want to display data from 2 different tables...

     

    I have one more problem. I'm not able to retrieve the data from the database..

    I am using

    while ($row = mysql_fetch_array(name of recordset))

    {//what i want to display}

     

     

  13. My add to cart is not inserting any data in the table..in fact i am getting errors like

     

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Apache2.2\htdocs\Jacey\showcart.php:10) in C:\Apache2.2\htdocs\Jacey\showcart.php on line 40

     

    Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\Jacey\showcart.php:10) in C:\Apache2.2\htdocs\Jacey\showcart.php on line 70

     

    Here is my code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    <meta name="description" content="description"/>
    <meta name="keywords" content="keywords"/> 
    <meta name="author" content="author"/> 
    <link rel="stylesheet" type="text/css" href="bntemplate590/images590/default.css"/>
    <title>Shopping Cart</title>
    <style type="text/css">
    <!--
    .style4 {font-size: 14pt}
    body,td,th {
    font-size: 9pt;
    }
    -->
    </style></head>
    
    <body>
    
    
    <div class="main">
    
    <div class="main_left">
    
    <div class="header">
    		<h1 align="center">Jacey Computers</h1>
      </div>
    
    	<div class="link_menu">
    		<a href="main.php" accesskey="1">Home</a>
    		<a href="category.php" accesskey="2">Product</a>
    		<a href="support.php" accesskey="3">Support & Help</a>
    		<a href="contact.php" accesskey="4">Contact Us</a>		</div>
    
    	<div class="content">
            <?php require_once('../Connections/JaceyConn.php'); 
    session_start();?>
    <?php
       // make sure the product id exist
       if (isset($_GET['product_id']) && (int)$_GET['product_id'] > 0) {
          $productId = (int)$_GET['product_id'];
       } else {
          header('Location: product.php');
       }
    
       // does the product exist ?
    mysql_select_db($database_JaceyConn, $JaceyConn);
    $sql = "SELECT product_id, product_quantity FROM product WHERE product_id = $productId";
    $add = mysql_query($sql, $JaceyConn) or die(mysql_error());
    $row_add = mysql_fetch_assoc($add);
    $totalRows_add = mysql_num_rows($add);
      
    
       if ($totalRows_add != 1) {
          // the product doesn't exist
          header('Location: showcart.php');
       } else {
          // how many of this product we
          // have in stock
          $row = mysql_fetch_array($add) ;
          $currentStock = $row['product_quantity'];
    
          if ($currentStock == 0) {
             // we no longer have this product in stock
             // show the error message
             echo"The product you requested is not available";
             header('Location: showcart.php');
             exit;
          }
       } 
    
       // current session id
       $sid = session_id();
    
       // check if the product is already
       // in cart table for this session
        mysql_select_db($database_JaceyConn, $JaceyConn);
       $sql1 = "SELECT product_id
               FROM cart
               WHERE product_id = $productId AND session_id = '$sid'";
    	  
    $ss = mysql_query($sql1, $JaceyConn) or die(mysql_error());
    $row_ss = mysql_fetch_assoc($ss);
    $totalRows_ss = mysql_num_rows($ss);
      
      
    
       if ($totalRows_ss == 0) {
          // put the product in cart table
          $sql2 = "INSERT INTO cart (product_id, quantity, session_id, date)
                  VALUES ($productId, 1, '$sid', NOW())";
    	$insert = mysql_query($sql2, $JaceyConn) or die(mysql_error());
         
       } else {
          // update product quantity in cart table
          $sql3 = "UPDATE cart 
                  SET quantity = quantity + 1
                  WHERE session_id = '$sid' AND product_id = $productId"; 
    
        $update = mysql_query($sql3, $JaceyConn) or die(mysql_error()); 
       }    
    
    
    ?>
            
    <table border="2" align="center" >
      <tr> 
       <td align="center">Item</td>
       <td align="center">Unit Price</td>
       <td align="center">Quantity</td>
       <td align="center">Total</td>
    </tr>
      </table>
    
    
    
           
    
    
           <form id="form1" method="post" action="order.php">
              <input name="order" type="submit" value="Confirm Order" />
                 or <a href="category.php"> Continue Shopping.</a>   
            </form>
           
          	  </div>
    </div>
    
    </div>
    <div class="footer"></div>
    </div>
    <br style="clear: both;" />
    
    </body>
    
    </html>
    

     

  14. OK now its being saved in the database...

    but not calculating the price...

    i have to work with 2 tables..i created to recordset..

     

    <?php require_once('../Connections/JaceyConn.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
    
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
    
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    }
    
    mysql_select_db($database_JaceyConn, $JaceyConn);
    $query_id = "SELECT * FROM configure";
    $id = mysql_query($query_id, $JaceyConn) or die(mysql_error());
    $row_id = mysql_fetch_assoc($id);
    $totalRows_id = mysql_num_rows($id);
    
    
    
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    <meta name="description" content="description"/>
    <meta name="keywords" content="keywords"/> 
    <meta name="author" content="author"/> 
    <link rel="stylesheet" type="text/css" href="bntemplate590/images590/default.css"/>
    <title>Jacey</title>
    <style type="text/css">
    <!--
    .style4 {font-size: 14pt}
    body,td,th {
    font-size: 9pt;
    }
    -->
    </style></head>
    
    <body>
    
    <div class="main">
    
    <div class="main_left">
    
    <div class="header">
    		<h1 align="center">Jacey Computers</h1>
      </div>
    
    	<div class="link_menu">
    		<a href="main.php" accesskey="1">Home</a>
    		<a href="category.php" accesskey="2">Product</a>
    		<a href="support.php" accesskey="3">Support & Help</a>
    		<a href="contact.php" accesskey="4">Contact Us</a>		</div>
    
    	<div class="content">
       
    	<table align="center" border="2">
             <?php
    
    	 $totalRows_id = mysql_num_rows($id);
    	 $row = mysql_fetch_array($id);
    	 $total=0;
    
    	 for($x=1; $x < $totalRows_id; $x++)
    	 {
    	 	$id=$row[x];
    		echo $id;
    		mysql_select_db($database_JaceyConn, $JaceyConn);
    		$query_price = "SELECT Product_name, product_price FROM product where product_id = '$id'; ";
    		$price = mysql_query($query_price, $JaceyConn) or die(mysql_error());
    		$row_price = mysql_fetch_assoc($price);
    		while($row2 = mysql_fetch_array($price)) {?>         
                <tr>
                <td>Product Name:<?php $row2['Product_name'];?></td>
                </tr>
                <tr>
    		<td> Price:<?php $row2['product_price'];?></td> 
                </tr>
                <?php }
                $total= $total+$row2['product_price'];
    		}?>
    		<tr>
                <td>Total Price:<?php echo $total;?></td>
                </tr>
                </table>  		
    
      <form id="form1" method="get" action="showcart.php">
    		  <p>
    		    <input type="submit" name="button" id="button" value="Add To Cart" />
    		  </p>
    		  <p><a href="configure.php">Go back</a> to previous page </p>
    		</form>
    
    
    </div>
    </div>
    
    <div class="footer"></div>
    </div>
    <br style="clear: both;" />
    
    </body>
    
    </html>
    

×
×
  • 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.