Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-15-2012, 03:54 PM   PM User | #1
Kaler40
New to the CF scene

 
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Kaler40 is an unknown quantity at this point
multiple tables read from mysql using json

Hello all, I have a task where I have to dynamically call in data from a mysql database to 4 seperate pages. Each page contains basically the same information but is relevent to a different college. The tables are collages, classes and feedback. Each page will take information from each of these databases tables. The tables are linked via the college_id key. I am using php and json to get the data. It is easy enough to use an array and use the index of the array to find the correct record of a table and append it to a div on a singular page. I have created an array that takes all the records of the table read so perth college record 1 is array[0], blairgowrie college is record 2, array[1] and so forth.
What I want to know is there a way I can take the id received from this array and use it to place the correct data onto the page, perth college details on the perth college page and blairgowire details on the blairgowrie page, but to do this only using the one json function. Is it possible or will I have to make multiple json function to carry out for the seperate pages.
Kaler40 is offline   Reply With Quote
Old 10-15-2012, 04:05 PM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
Yes, it is possible

What have you tried?
devnull69 is offline   Reply With Quote
Old 10-15-2012, 06:59 PM   PM User | #3
Kaler40
New to the CF scene

 
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Kaler40 is an unknown quantity at this point
At this moment I havent tried any solution, I know i could create multiple functions to cover the different pages but I felt it would be better coding practice to centralise and minimise the functions used to carry this out, i am just unsure how to go about it.
Kaler40 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:21 AM.


Advertisement
Log in to turn off these ads.