happybanana
02-04-2013, 12:51 PM
Hi,
I have a database with two tables that I'm using to construct one large HTML table out of. I've coded a solution but it uses a loop inside a loop with some mysql_data_seek hacks and it's getting slow. I'm hoping to speed it up.
One database table is essentially providing a 'parent title' and the other table is providing child sub parts to each title.
For example, table parent:
id text
1.1.2 This is a parent row
1.1.3 This is another parent row
table child:
id text
1.1.2.a This is child text belonging to 1.1.2
1.1.2.b This is child text belonging to 1.1.2
1.1.2.c This is child text belonging to 1.1.2
1.1.3.a This is another child row
Now I *could* just combine everything into one table but that gets awkward for me elsewhere in my program.
The code I created (and the core logic I need to replicate) needs to check that parent.id >= child.id AND parent.id < a mysql pointer I have looking ahead in child.id. This is because the table has to format with parent and child parts formatted correctly.
I hope I've explained that OK. Can anyone offer any suggestions?
I have a database with two tables that I'm using to construct one large HTML table out of. I've coded a solution but it uses a loop inside a loop with some mysql_data_seek hacks and it's getting slow. I'm hoping to speed it up.
One database table is essentially providing a 'parent title' and the other table is providing child sub parts to each title.
For example, table parent:
id text
1.1.2 This is a parent row
1.1.3 This is another parent row
table child:
id text
1.1.2.a This is child text belonging to 1.1.2
1.1.2.b This is child text belonging to 1.1.2
1.1.2.c This is child text belonging to 1.1.2
1.1.3.a This is another child row
Now I *could* just combine everything into one table but that gets awkward for me elsewhere in my program.
The code I created (and the core logic I need to replicate) needs to check that parent.id >= child.id AND parent.id < a mysql pointer I have looking ahead in child.id. This is because the table has to format with parent and child parts formatted correctly.
I hope I've explained that OK. Can anyone offer any suggestions?