How to pull details from accounts table

7 posts by 3 authors in: Forums > CMS Builder
Last Post: June 7, 2010   (RSS)

Re: [jonoc73] How to pull details from accounts table

By Chris - June 4, 2010 - edited: June 4, 2010

Hi Jono,

Since this is a multi-list, there will be multiple records (i.e. an array.) You'll need to iterate over them. Try replacing this:

Added by <?php foreach ($blogRecords as $rec): ?><?php echo $rec['name']; ?><?php endforeach ?>

with this:

Added by <?php foreach ($record['name'] as $account): ?><a href="<?php echo $account['profile_url'] ?>"><?php echo $account['fullname']; ?></a><?php endforeach ?>

Does that help? Please let me know if you have any questions!
All the best,
Chris

Re: [chris] How to pull details from accounts table

By (Deleted User) - June 4, 2010

Hi Chris,

Thanks for trying to help. I change the code to as you described but I am getting a:

Notice: Uninitialized string offset: 0

error however.

J

Re: [jonoc73] How to pull details from accounts table

By Chris - June 4, 2010

Hi J,

Hmm, can you try wrapping that in an IF statement to see if some funky data got in there somehow?

<?php if (is_array($record['name'])): ?>

Added by <?php foreach ($record['name'] as $account): ?><a href="<?php echo $account['profile_url'] ?>"><?php echo $account['fullname']; ?></a><?php endforeach ?>

<?php else: ?>
<?php showme($record['name']) ?>
<?php endif ?>


If something other than an array is in there, this code will spit out what it is. What do you get when you run this?
All the best,
Chris

Re: [chris] How to pull details from accounts table

By (Deleted User) - June 4, 2010

Afraid I am still getting same error.

Funky data is the problem! [;)]

I have added the blog.php page for more info.

J
Attachments:

blogs.php 19K

Re: [jonoc73] How to pull details from accounts table

By Jason - June 7, 2010

Hi,

What line does it say the error is occurring on?

On line 147, put in this code:

<?php showme($record); exit; ?>

Run the file, and copy what it outputs into a text file and attach it to this post. Once you`ve done that you can remove the code.

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] How to pull details from accounts table

By (Deleted User) - June 7, 2010

Jason,

Due to personal info in details requested I have messaged you instead.

Thanks Jono