Jump to content

devan

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

devan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi guys, How would I write a small script in php to count the unique values in the below array : the below code if part of cubecart 3.20 shopping cart, I need to count the unique number of Seller_ID fields within this array in the basket to be able to calculate shipping according to the number of sellers. How would I to this ? please any help is appreciated. if(isset($_GET['act']) && $_GET['act']=="step4"){ // set live vars for order inv and its the last step $view_cart->assign("QUAN_DISABLED","disabled"); $view_cart->assign("TEXT_BOX_CLASS","textboxDisabled"); $basket = $cart->setVar($productId,"productId","invArray",$i); $basket = $cart->setVar($product[0]['name'],"name","invArray",$i); $basket = $cart->setVar($product[0]['productCode'],"productCode","invArray",$i); $basket = $cart->setVar($plainOpts,"prodOptions","invArray",$i); $basket = $cart->setVar(sprintf("%.2f",$price*$quantity),"price","invArray",$i); $basket = $cart->setVar($quantity,"quantity","invArray",$i); $basket = $cart->setVar($product[0]['digital'],"digital","invArray",$i); $basket = $cart->setVar($product[0]['Prod_Seller'],"Prod_Seller","invArray",$i); $basket = $cart->setVar($product[0]['Seller_ID'],"Seller_ID","invArray",$i); } else { $basket = $cart->unsetVar("invArray"); }
  2. Thank you for your help, I located the problem with your code and fixed it, all sorted
  3. Hi, I added the code you provided ( thanks ) to check the error, this is what MySQL error I get : Query failed: SELECT productId, productCode, image, name, price, stock_level FROM CubeCart_inventory WHERE productCode LIKE '%gold%' OR name LIKE '%gold%' AND Seller_ID = '25' order by name limit -35, 35 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-35, 35' at line 1
  4. Hi, no, the code in within the PHP tags, I only wish it was that easy ! :'(
  5. Hi guys, for the life of me, what am I doing wrong, I cannot figure out this one, getting this error : Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ......... search.php on line 36 my code : $start = ($page-1)*$per_page; $sql = "SELECT productId, productCode, image, name, price, stock_level FROM inventory WHERE productCode LIKE '%".$searchp."%' OR name LIKE '%".$searchp."%' AND Seller_ID = '" . $_SESSION['SESS_SELL_ID'] . "' order by name limit $start,$per_page"; $rsd = mysql_query($sql); <?php while($row = mysql_fetch_array($rsd)) // ERROR OCCURS HERE : line 36 { $idpc=$row['productId']; $idc=$row['productCode']; $idi=$row['image']; $idn=$row['name']; $idp=$row['price']; $ids=$row['stock_level']; ?> all help appreciated as always.
  6. I want to have a search product feature, but I would like members to be able to search multiple fields in one go i.e. product_code, Product_name in one MySQL query. The thing is, members have to be logged on, so the query must also only show results relating to that specific member, via the session[member_ID], my current query for listing products for that specific member is : $sql = "SELECT productId, productCode, image, name, price, stock_level FROM product_inventory WHERE memberr_ID = '" . $_SESSION['SESS_mem_ID'] . "; How would I change the above into a search query to search for productcode, productname and still only show results beloging to this member using the session data ? all help appreciated
  7. Hi, I am getting the following error in my UPDATE query : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `productId`='1143'' at line 12 My code : $sqlEdit = "UPDATE CubeCart_inventory SET `productCode`='$prodcode', `quantity`='$prodqsa', `description`='$proddes', `image`='$imagesaveme2', `price`='$prodsell', `name`='$prodtitle', `cat_id`='$category', `sale_price`='$prodsale', `stock_level`='$prodqty', `Prod_Condition`='$prodcon', `Prod_Waiting`='$prodperiod', WHERE `productId`='$prodid'"; $result = @mysql_query($sqlEdit); What might be the problem ? MySQL is saying line 12 is wrong : This Line : WHERE `productId`='$prodid'"; please help!
  8. TRUNCATE TABLE CubeCart_cats_idx; INSERT INTO CubeCart_cats_idx (productid, cat_id) SELECT productid, cat_id FROM CubeCart_inventory; I an running the following in MyPHPAdmin, but need this to be automated in a PHP script, how would I do it ? all help is appreciated, still new to PHP & MySQL many thanks D
×
×
  • 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.