Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to retrieve data from mysql database and populate in list view in jquery mobile
    primarykey
    data
    text
    <p>please someone help me to find the solution for how to retrieve data from mysql database and populate in list view in jquery mobile.</p> <p>am having the php code as follows</p> <pre><code>&lt;? php include('libraries/config.php'); $result = mysql_query("SELECT * from category") or die(mysql_error()); while ($obj = mysql_fetch_object($result)) { $arr[] = $obj; } echo json_encode($data); echo '{"Deals":'.json_encode($arr).'}'; ?&gt; </code></pre> <p>here am getting the data from mysql in json format but i was not known how to populate this in listview, my html page is as follows</p> <pre><code>&lt;div id="content-area" style="height:auto;"&gt; &lt;br/&gt; &lt;ul data-role="listview"&gt; &lt;li&gt; &lt;a href="comfort_list.html"&gt; &lt;div class="content-home-tab1"&gt; &lt;div class="img-content"&gt; &lt;img id="ic_home" src="images/next_btn.png" style="margin-top:37px; margin-left:448px;" width="22" height="28" /&gt; &lt;/div&gt; &lt;div class="content-home-p"&gt; &lt;b&gt;Comfort&lt;/b&gt; &lt;/div&gt; &lt;/div&gt; &lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt; &lt;div class="content-home-tab1"&gt; &lt;div class="img-content"&gt; &lt;img id="ic_home" src="images/next_btn.png" style="margin-top:37px; margin-left:448px;" width="22" height="28" /&gt; &lt;/div&gt; &lt;div class="content-home-p"&gt; &lt;b&gt;Handling Your Lenses&lt;/b&gt; &lt;/div&gt; &lt;/div&gt; &lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Here in my code am giving static data to list that is comfort and handling your lens, am having this data in db and i need to get that and to be placed here.</p> <p>in the page i am posting in a form like this</p> <pre><code>&lt;form method="post" action="help.html"&gt; &lt;ul data-role="listview" &gt; &lt;?php while ($row = $stmt-&gt;fetch()){ ?&gt; &lt;li&gt; &lt;a href="help1.php?id=&lt;?php echo $row['categoryID']; ?&gt;"&gt; &lt;div class="content-home-tab1"&gt; &lt;div class="img-content"&gt; &lt;img id="ic_home" src="images/next_btn.png" style="margin-top:37px; margin-left:448px;" width="22" height="28" /&gt; &lt;/div&gt; &lt;div class="content-home-p"&gt; &lt;b&gt;&lt;?php echo $row['title'];?&gt; &lt;/b&gt; &lt;/div&gt;&lt;/div&gt;&lt;/a&gt; &lt;/li&gt; &lt;?php }?&gt; &lt;/ul&gt; &lt;/form&gt; </code></pre> <p>and in another page am trying to get the id as follows</p> <pre><code>&lt;?php include('libraries/config.php'); $getID = $_GET['id']; echo $getID; $stmt = $db-&gt;prepare("SELECT * from category where categoryID ='$_GET['id']'"); $stmt-&gt;execute(); ?&gt; </code></pre> <p>but when going to that page it is showing nothing and when refreshed then it is showing so that only am asking how to get it to fetch data and print it when the page is loaded. thanks.</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.
 

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