Hello, i am a javascript newbie, as well as in php/mysql
and i need some help on some web app admin interface i have the task to developp:
i have a long list of object: books with properties like title, author, publication date, subject, similar books list with their title and date of publication.
how do i generate the list books object after getting that list of books after retrieving it through php from a mysql database and then display that list of books in an HTML table?
Then i would like to be able for the user of that admin system to be able to sort the list by title, author, date or even subject?
why all of this should be done in JS instead of php, it's because i have been ordered to do dev this in JS by my boss (i ma an intern)
i would like to have the layout of the functions i have to write to do this three things!
1-generate javascript objects Books (list?) out of php/mysql!
2-display the list of book in html table (one cell with title, author, publication and subject) and the second cell (lits of similar books with title and date of publication)
3-sorting books by title, author, date or subject
Thanks in advance
Js Object from PHP/Mysql: display and sort!
Moderator: General Moderators
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Ooh, that's interesting. I don't want to give you too much if this is a test of some sort.
What you'll want to do is either create a class for the books, or just use JSON.
What you'll want to do is either create a class for the books, or just use JSON.
Code: Select all
while($data = mysql_fetch_object($result))
{
echo 'book[] = {title : "' . $result->title . '", author : "' . $result->author . '", date : "' . $result->date . '"};';
}