Quick MySQL Lookup
4 posts by 3 authors in: Forums > CMS Builder
Last Post: December 7, 2011 (RSS)
This seems so silly but I can't get my head around it...
I'm using a list field to pull data from a bunch of other records in another table.
In this case the value is the record $num and the label is the record $title - or at least it should be.
In order to make it easier for the user to find the the right record in the list, I'm using the breadcrumb option.
So whenever I return the label of this field, what I actually get is the entire breadcrumb trail : etc : etc!
All I actually need is the record $title.
I think I need to perform some sort of mini mysql look-up which would work something like this:
look-up this table and return the $title which matches this $num
...or something like that.
Can anyone help, please?
:o)
Perch
Re: [Perchpole] Quick MySQL Lookup
Hi Perch,
Don't have any idea if this will help. but I used it to limit the values returned.
You might be able to use the same approach and echo the $title
foreach ($master_subscription_pagesRecords as $record): ?>
<?php if ($record['createdByUserNum']== @$CURRENT_USER['num']): ?>
more code...
Just a thought...
Jerry Kornbluth
Don't have any idea if this will help. but I used it to limit the values returned.
You might be able to use the same approach and echo the $title
foreach ($master_subscription_pagesRecords as $record): ?>
<?php if ($record['createdByUserNum']== @$CURRENT_USER['num']): ?>
more code...
Just a thought...
Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [Perchpole] Quick MySQL Lookup
By Jason - December 7, 2011
Hi Perch,
If you're using CMS Builder version 2.08 or higher, you can use something like this:
Since you're using breadcrumb as an option, I'm assuming that this is pulling from a category section. Assuming that this section is named "categories" and the field in your record is called "category", you can get the corresponding record like this:
Hope this helps
If you're using CMS Builder version 2.08 or higher, you can use something like this:
Since you're using breadcrumb as an option, I'm assuming that this is pulling from a category section. Assuming that this section is named "categories" and the field in your record is called "category", you can get the corresponding record like this:
<?php
$category = mysql_get('categories', $record['category']);
echo $category['title'];
?>
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/
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] Quick MySQL Lookup
Jason -
Perfect. Exactly what I was looking for.
:0)
Perch
PS. Thanks for chipping in Gerry.
Perfect. Exactly what I was looking for.
:0)
Perch
PS. Thanks for chipping in Gerry.