Jump to content

strugling with get and where function


Recommended Posts

so when you have


1) how can you get the_id_for_the_content from the url. 

is that something like $the_id = $_GET['the_id_for_the_content'];               

2) how can you set that it has to search for customer id AND the_id_for_the_content

$where = array('customer_id' => $GLOBALS['user']->get('customer_id')); 

 if (($get_the_content = $GLOBALS['db']->select('CubeCart_database_name', false, $where, array('id' => 'DESC'), $per_page, $page, false)) !== false) {

                can't seem to get it to work






Link to comment
Share on other sites



We recommend to use a leading underscore for the key name of the contentType.

CubeCart will first try to build a friendly URL - but I won't get into that now.

1) Correct. The $_GET array will have the key ['product_id'] holding the value "67".

2) You can use $GLOBALS['user']->get() to get the logged-in customer ID value from the session.

What data needs to be supplied in the query, of course, depends which table you are querying. But the format is correct.

(The CubeCart_order_summary table has details about the customer, including the 'customer_id', but not the 'product_id' of any of the items in the order. The data about the order's items is in the CubeCart_order_inventory table, but no data about the customer. The one thing that joins these two tables is CubeCart's standard cart_order_id code.)

Also, records returned are in an indexed array. That means $get_the_content is an array where the keys are numbered starting at [0], and the content of each array element is itself an associative array, such as ['customer_id'] holding the value "67". All together: $get_the_content[0]['customer_id'] holds "67".

Link to comment
Share on other sites

Posted (edited)

  $get_the_content = $_GET['scr_id'];
  $where = $get_the_content[0]['customer_id'];                    

   if (($weergaven = $GLOBALS['db']->select('CubeCart_content', false, $where, array('id' => 'DESC'), false)) !== false) {
   foreach ($weergaven as $weergeven) {

if i try this it doesn't print result. 

so the table content contains : row customer_id and get_the_content

with the scr code provided in url and customer id : there will be 1 result 

Edited by SentiJB
Link to comment
Share on other sites

Join the conversation

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

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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