Note that there are some explanatory texts on larger screens.

plurals
  1. POjson inputting data from sql database while loop
    primarykey
    data
    text
    <p>I have a code of json but I don't know how to input the while loop.</p> <p>I have the code edited the contents but i don't have an idea how to while loop a json because I'm getting distracted by the , next line it means next picture right tried to add one it works but don't know how to insert while on it here's the link of the example.</p> <p><a href="http://demo1.krablekod.ru/agile_carousel/examples/agile_carousel_multiple_slides_visible_example.html" rel="nofollow">link</a></p> <pre><code>&gt; agile_carousel_data.php &gt; &lt;?php &gt; include_once('includes/dbConnect.php'); &gt; &gt; &gt; ?&gt; &lt;?php &gt; &gt; $query = mysql_query("select * from persons order by rand()"); &gt; &gt; while ($test = mysql_fetch_array($query)) { &gt; &gt; } &gt; &gt; &gt; &gt; ?&gt; [ { &gt; "content": "&lt;div class='slide_inner'&gt;&lt;a class='photo_link' href='#'&gt;&lt;img class='photo' src='banner_bike.jpg' &gt; alt='Bike'&gt;&lt;/a&gt;&lt;a &gt; class='caption' href='#'&gt;Sample Carousel Pic Goes Here And The Best &gt; Part is that...&lt;/a&gt;&lt;/div&gt;", &gt; "content_button": "&lt;div class='thumb'&gt;&lt;img src='f2_thumb.jpg' alt='bike is nice'&gt;&lt;/div&gt;&lt;p&gt;Agile Carousel Place &gt; Holder&lt;/p&gt;" }, { &gt; "content": "&lt;div class='slide_inner'&gt;&lt;a class='photo_link' href='#'&gt;&lt;img class='photo' src='banner_paint.jpg' &gt; alt='Paint'&gt;&lt;/a&gt;&lt;a &gt; class='caption' href='#'&gt;Sample Carousel Pic Goes Here And The Best &gt; Part is that...&lt;/a&gt;&lt;/div&gt;", &gt; "content_button": "&lt;div class='thumb'&gt;&lt;img src='f2_thumb.jpg' alt='bike is nice'&gt;&lt;/div&gt;&lt;p&gt;Agile Carousel Place &gt; Holder&lt;/p&gt;" }, { &gt; "content": "&lt;div class='slide_inner'&gt;&lt;a class='photo_link' href='#'&gt;&lt;img class='photo' src='banner_bike.jpg' &gt; alt='Bike'&gt;&lt;/a&gt;&lt;a &gt; class='caption' href='#'&gt;Sample Carousel Pic Goes Here And The Best &gt; Part is that...&lt;/a&gt;&lt;/div&gt;", &gt; "content_button": "&lt;div class='thumb'&gt;&lt;img src='f2_thumb.jpg' alt='bike is nice'&gt;&lt;/div&gt;&lt;p&gt;Agile Carousel Place &gt; Holder&lt;/p&gt;" }, { &gt; "content": "&lt;div class='slide_inner'&gt;&lt;a class='photo_link' href='#'&gt;&lt;img class='photo' src='banner_paint.jpg' &gt; alt='Paint'&gt;&lt;/a&gt;&lt;a &gt; class='caption' href='#'&gt;Sample Carousel Pic Goes Here And The Best &gt; Part is that...&lt;/a&gt;&lt;/div&gt;", &gt; "content_button": "&lt;div class='thumb'&gt;&lt;img src='f2_thumb.jpg' alt='bike is nice'&gt;&lt;/div&gt;&lt;p&gt;Agile Carousel Place &gt; Holder&lt;/p&gt;" }, { &gt; "content": "&lt;div class='slide_inner'&gt;&lt;a class='photo_link' href='#'&gt;&lt;img class='photo' src='banner_bike.jpg' &gt; alt='Bike'&gt;&lt;/a&gt;&lt;a &gt; class='caption' href='#'&gt;Sample Carousel Pic Goes Here And The Best &gt; Part is that...&lt;/a&gt;&lt;/div&gt;", &gt; "content_button": "&lt;div class='thumb'&gt;&lt;img src='f2_thumb.jpg' alt='bike is nice'&gt;&lt;/div&gt;&lt;p&gt;Agile Carousel Place &gt; Holder&lt;/p&gt;" }, { &gt; "content": "&lt;div class='slide_inner'&gt;&lt;a class='photo_link' href='#'&gt;&lt;img class='photo' src='banner_paint.jpg' &gt; alt='Paint'&gt;&lt;/a&gt;&lt;a &gt; class='caption' href='#'&gt;Sample Carousel Pic Goes Here And The Best &gt; Part is that...&lt;/a&gt;&lt;/div&gt;", &gt; "content_button": "&lt;div class='thumb'&gt;&lt;img src='f2_thumb.jpg' alt='bike is nice'&gt;&lt;/div&gt;&lt;p&gt;Agile Carousel Place &gt; Holder&lt;/p&gt;" }, { &gt; "content": "&lt;div class='slide_inner'&gt;&lt;a class='photo_link' href='#'&gt;&lt;img class='photo' src='Penguins.jpg' &gt; alt='Tunnel'&gt;&lt;/a&gt;&lt;a &gt; class='caption' href='#'&gt;Sample Carousel Pic Goes Here And The Best &gt; Part is that...&lt;/a&gt;&lt;/div&gt;", &gt; "content_button": "&lt;div class='thumb'&gt;&lt;img src='f2_thumb.jpg' alt='bike is nice'&gt;&lt;/div&gt;&lt;p&gt;Agile Carousel Place &gt; Holder&lt;/p&gt;" }, { &gt; "content": "&lt;div class='slide_inner'&gt;&lt;a class='photo_link' href='#'&gt;&lt;img class='photo' src='Penguins.jpg' &gt; alt='Tunnel'&gt;&lt;/a&gt;&lt;a &gt; class='caption' href='#'&gt;Sample Carousel Pic Goes Here And The Best &gt; Part is that...&lt;/a&gt;&lt;/div&gt;", &gt; "content_button": "&lt;div class='thumb'&gt;&lt;img src='f2_thumb.jpg' alt='bike is nice'&gt;&lt;/div&gt;&lt;p&gt;Agile Carousel Place &gt; Holder&lt;/p&gt;" } &gt; &gt; ] </code></pre> <p>here's my code for the while loop and query</p> <pre><code>$query=mysql_query("select * from persons order by date desc LIMIT 0,10 "); &gt; &lt;img height=200 width=200 src=' upload/". $test['Image'] ."'/&gt; &lt;a href &gt; ='profile.php?PersonID=$id'&gt; ".$test['LastName'].", ". $test['FirstName']." ". $test['MiddleName']."&lt;/a&gt; </code></pre> <p>and here's my script file for calling the code</p> <pre><code>&gt; agile_carousel_multiple_slides_visible_example.html &gt; &gt; &lt;script&gt; &gt; &gt; $.getJSON("agile_carousel_data.php", function (data) { &gt; &gt; $("#multiple_slides_visible").agile_carousel({ &gt; carousel_data: data, &gt; carousel_outer_height: 230, &gt; carousel_height : 200, &gt; slide_height : 200, &gt; carousel_outer_width : 480, &gt; slide_width : 260, &gt; number_slides_visible: 3, &gt; transition_time : 330, &gt; control_set_1: "previous_button,next_button", &gt; control_set_2: "group_numbered_buttons", &gt; persistent_content: "&lt;p class='persistent_content'&gt;Agile Carousel Example: Multiple Slides Visible&lt;/p&gt;" &gt; }); &gt; &gt; }) &gt; &gt; &lt;/script&gt; </code></pre> <p>tried this code but won't output anything</p> <pre><code>&gt; `&lt;?php include_once('includes/dbConnect.php'); $data = array(); while &gt; ($test = mysql_fetch_array($query)) { $data[]['content'] = "&lt;div &gt; class='slide_inner'&gt;&lt;a class='photo_link' href='#'&gt;&lt;img class='photo' &gt; src='{$test['image']}' alt='Bike'&gt;&lt;/a&gt;&lt;a class='caption' &gt; href='#'&gt;Sample Carousel Pic Goes Here And The Best Part is &gt; that...&lt;/a&gt;&lt;/div&gt;" $data[]['content_button'] = "&lt;div &gt; class='thumb'&gt;&lt;img src='{$test['thumb']}' alt='bike is &gt; nice'&gt;&lt;/div&gt;&lt;p&gt;Agile Carousel Place Holder&lt;/p&gt;" } echo &gt; json_encode($data); ?&gt; </code></pre> <p>`</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload