close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

JSON nested repeat region - how to do it?

Thread began 1/21/2017 7:01 pm by Janet | Last modified 1/23/2017 5:06 pm by Janet | 2638 views | 11 replies


JSON nested repeat region - how to do it?

I have a database table with one field that contains JSON . Each row of the database contains simple text fields called fields called TITLE, SUBTITLE, and DESCRIPTION, and the JSON data field called IMAGE

When the IMAGE JSON contains one image the following code works, but I have no clue how to add the code that would nest repeat all the images included in the JSON field as images.

The code I am using for single images per row is:

while(!$DETAILS->atEnd()) {

<div class="row">
<div class="col-md-8">
<h2><?php echo($DETAILS->getColumnVal("TITLE")); ?></h2>
<p><strong><?php echo($DETAILS->getColumnVal("SUBTITLE")); ?></strong></p>
<?php echo($DETAILS->getColumnVal("DESCRIPTION")); ?>

<div class="col-md-4">


$json = $DETAILS->getColumnVal("IMAGE");

$myArray = json_decode($json, true);

<?php if ($DETAILS->getColumnVal("IMAGE") != "") { ?>
<img src="input/<?php echo $myImage = $myArray[0]["name"]; ?>" class="img-responsive center-block" alt="<?php echo $DETAILS->getColumnVal("TITLE"); ?>">
<?php } ?>
$DETAILS->moveFirst(); //return RS to first record

An example of the 'multi-image' JSON is : [{"name":"images\/03_y8osnwim.jpg","usrName":"03.jpg","size":98665,"type":"image\/jpeg","thumbnail":"images\/th03_jdfcm55b.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":11684,"searchStr":"03.jpg,!11.jpg,!01.jpg,!12.jpg,!02.jpg,!13.jpg,!05.jpg,!14.jpg,!06.jpg,!:sStrEnd"},{"name":"images\/11_ipi01ygc.jpg","usrName":"11.jpg","size":96945,"type":"image\/jpeg","thumbnail":"images\/th11_g5cqaao1.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":12155},{"name":"images\/01_xv69cder.jpg","usrName":"01.jpg","size":98327,"type":"image\/jpeg","thumbnail":"images\/th01_bep2e90t.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":11359},{"name":"images\/12_mhancpnr.jpg","usrName":"12.jpg","size":104597,"type":"image\/jpeg","thumbnail":"images\/th12_4et19bu1.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":10972},{"name":"images\/02_j1bblk53.jpg","usrName":"02.jpg","size":123075,"type":"image\/jpeg","thumbnail":"images\/th02_midqduuw.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":13143},{"name":"images\/13_8iawh5dk.jpg","usrName":"13.jpg","size":108840,"type":"image\/jpeg","thumbnail":"images\/th13_ghuqpvtj.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":11991},{"name":"images\/05_ujgcogbd.jpg","usrName":"05.jpg","size":116858,"type":"image\/jpeg","thumbnail":"images\/th05_o319l82a.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":12247},{"name":"images\/14_lftyibpj.jpg","usrName":"14.jpg","size":127039,"type":"image\/jpeg","thumbnail":"images\/th14_5bzrctsz.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":11481},{"name":"images\/06_urku1k0z.jpg","usrName":"06.jpg","size":174727,"type":"image\/jpeg","thumbnail":"images\/th06_73yma7ny.jpg","thumbnail_type":"image\/jpeg","thumbnail_size":15751}]

Any advice you can give would be much appreciated. MySQLi and JSON newbie!

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...