Where = limited results

17 posts by 3 authors in: Forums > CMS Builder
Last Post: April 27, 2011   (RSS)

By Jason - April 19, 2011

Hi,

You have to options for "where" in your query. Your second one will overwrite the first, which is why your record isn't coming up.

Try changing this:
// load records
list($product_categoriesRecords, $product_categoriesMetaData) = getRecords(array(
'tableName' => 'product_categories',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
'where' => ' title="Loudspeakers" ',

));


to this:

// load records
list($product_categoriesRecords, $product_categoriesMetaData) = getRecords(array(
'tableName' => 'product_categories',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',

));


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Jason - April 20, 2011

Hi,

Could you please re-attach your .php file so we can see the latest version of the code you're working with.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Where = limited results

By degreesnorth - April 20, 2011

Here it is.
Thanks

By Jason - April 21, 2011

Hi,

What must be happening here is that your category value for each record must not be found in any of the options you're using (4,5,19,32,13,29,7) (note, you're actually using 7 twice, so if if category ever equaled 7, only the second if statement would end up being used).

What value are you using for your category field? We can check to see what values are there by adding this code: (change in red)

$link = "default-file.php";
showme("*".$record['category']."*");
if ($record['category'] == 4) { $link = "category_architectural_speakers.php"; }
if ($record['category'] == 8) { $link = "category_bookshelf_speakers.php"; }
if ($record['category'] == 19) { $link = "category_floorstanding_speakers.php"; }
if ($record['category'] == 32) { $link = "category_outdoor_speakers.php"; }
if ($record['category'] == 13) { $link = "category_computer_speakers.php"; }
if ($record['category'] == 29) { $link = "category_lifestyle_speakers.php"; }
if ($record['category'] == 7) { $link = "category_sub_woofers.php"; }
if ($record['category'] == 7) { $link = "category_home_theatre_speakers.php"; } $link .= "?";
$link .= $record['num'];


For each record, this will output the value of the category field with asterisk on either side. Try than and let me know what values are being outputted.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Where = limited results

By degreesnorth - April 26, 2011

Hi Jason
No, no change. Still doesn't work. It's still trying to find the location of the /default-file.php?14 (or whatever page), although my categories are correct. Also, with one of the changes you listed earlier, the page title is now defaulting to Accessories, rather than Loudspeakers, because you asked me to remove the "where" = loudspeakers. Any ideas, or do I need to actually hardcode this in to get this resolved.
Thanks
PHP File attached again.

By Jason - April 27, 2011

Hi,

If you could fill out a [url http://www.interactivetools.com/support]2nd Level Support Request[/url] we can take a closer look at this issue for you.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/