Problem with php product lock code in Opencart

Discussion in 'eCommerce' started by digiRich, Mar 2, 2012.

  1. #1
    Hello all.


    I have Open Cart 1.5.1.3 installed and have added a fair bit of additional functinality. I have hit a wall with one thing. I have been learning both php and MySQL along the way so please bare with me.


    I have the following php snippit in my site:


    <?php   $sql = "SELECT `status` FROM `product_lock_sold`";
         $result = mysql_query($sql) or die (mysql_error());       
    if(mysql_num_rows($result)) {     
    $value = mysql_result($result, 0);    
     if($value == "0") { ?> <p>**MESSAGE**</p> <?php   }   } ?>
    
    PHP:


    There is also a column for 'product_id' in that table.
    I am basically trying to get a message to display if the item is in someones cart already. The code above is checking if the status is '0' ok, but I need it to check that the 'product_id' is that of the item they are viewing at that time.


    Sorry if this post is a bit all over the place. Just really need some pointers
     
    Last edited: Mar 2, 2012
    digiRich, Mar 2, 2012 IP