0

I am creating a json multidimentional Array for use in my jquery mobile panel and it works like a charm, but...

Now I want to make some af the panel list dynamic and get some af the data from database and I don't know how to do this?

Here is my static array:

$panels = array(
        array('list' => '<li><a href="../index.html">Start</a></li>'),
        array('list' => '<li><a href="#">My profile</a></li>'),
        array('list' => '<li><a href="#">Statistics</a></li>'),
        array('list' => '<li data-role="list-divider">My groups</li>'),
        array('list' => '<li><a href="pages/grouppage.html?groupid=1" rel="external">My first group</a></li> '),
        array('list' => '<li><a href="pages/grouppage.html?groupid=5" rel="external">I am testing again</a></li> '));

As you can see, my last 2 lists are the same and should come from my database depending on which user it is, but I don't know how to do this?

Hoping for help and thanks in advance :-)

2
  • 1
    What is your question? How to use a MySQL query? Commented Apr 16, 2013 at 9:04
  • Did you already designed a database structure. Its not clear what you already tried or what your question is. Commented Apr 16, 2013 at 9:05

2 Answers 2

1
$database_data = "some data from database";
$data = array('list'=>$database_data);
$panels[] = $data ;
Sign up to request clarification or add additional context in comments.

Comments

0

This should work for you and write your query as per the requirement..

 while ($r = mysql_fetch_array($query)) {
    $arr[] = array(
                'list' => '<li><a href='" . $r['page_url'] . "'>" . $r['page_name'] . "</a></li>'
            );
 }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.