cuboidgraphix Posted June 17, 2008 Share Posted June 17, 2008 Hello guys, In the past you have all been very helpful to me. This is an ongoing project I'm working on and it's time for an upgrade. I'm trying to design a page that when it loads up, it shows a statistics table. On the first column, I'm trying to generate links that will be integrated with AJAX, that will generate another mysql query and break down in another "sub table" that will slide under the row. Each row will be a different table, only visible when clicking on the link on the first column. So far this is a chunk of my output code. <?php // This is the query that generates the table. $query = "SELECT CONCAT('BTS10',(SUBSTRING(LPAD(CELL,5,0),1,2))) AS 'BTS No.', Date, SUM(CALL_ATTEMPTS) AS 'Attempt', SUM(CALL_SUCCESS) AS 'Success', (SUM(CALL_SUCCESS)/SUM(CALL_ATTEMPTS))*100 AS '% Succ.', SUM(BLOCKS) AS 'Block', (SUM(BLOCKS)/SUM(CALL_ATTEMPTS))*100 AS '% Block', SUM(FAILS) AS 'Fail', (SUM(FAILS)/SUM(CALL_ATTEMPTS))*100 AS '% Fail', SUM(SCREEN_CALLS) AS 'Screen', (SUM(SCREEN_CALLS)/SUM(CALL_ATTEMPTS))*100 AS '% Screen', SUM(DROP_CALLS) AS 'Drop', (SUM(DROP_CALLS)/SUM(CALL_SUCCESS))*100 AS '% Drop' FROM PERCELL WHERE DATE = '$fecha' AND TYPE = '24 HOURS' GROUP BY 'BTS No.'"; $data = mysql_query("$query;") or die(mysql_error()); // Table Output print "<table width=\"800\">"; print "<tr>"; for($i = 0;$i < mysql_num_fields($data);$i++) { $fieldname = mysql_field_name($data, $i); print "<th>" .$fieldname . "</th>"; } print "</tr>"; for ($i = 0; $i < mysql_num_rows($data); $i++) { print "<tr>"; $row = mysql_fetch_row($data); for($j = 0;$j < mysql_num_fields($data);$j++) { $fieldname = mysql_field_name($data, $j); if ($fieldname === "Type") { $hrs = str_replace('HOURS', "HRS", $row); } elseif ($fieldname === "BTS No."){ /* Here is where i want to put the script that will generate the links on the first column (BTS No.) This table generates 30 rows, that will have an AJAX effect that will 'Accordion' into another 'SubTable' below each row whenever someone clicks on the generated links in the first row. As for the subtables, it will require a separate mysql query to generate it. Note: The Links will be the same name/value as the value in the database. eg rows: BTS1001 , BTS1002 , BTS1003 ... etc. */ } else { $hrs = $row; } echo("<td class=\"".color($fieldname, $hrs[$j])."\">" . $hrs[$j] . "</td>"); } print "</tr>"; } print "</table>"; ?> Anyways I hope one of you guys can help me out. I've been at it for two days and nothing seems to work. I'm not an expert, but I do read up a lot. If you could help me out I'll really appreciate it. Quote Link to comment Share on other sites More sharing options...
cuboidgraphix Posted June 18, 2008 Author Share Posted June 18, 2008 Any help guys? Please... Quote Link to comment Share on other sites More sharing options...
cuboidgraphix Posted June 18, 2008 Author Share Posted June 18, 2008 Anyone? Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted June 18, 2008 Share Posted June 18, 2008 you never asked a question... one of my favorite quotes on this forum: The quality of response varies DIRECTLY from the quality of question asked Quote Link to comment Share on other sites More sharing options...
cuboidgraphix Posted June 18, 2008 Author Share Posted June 18, 2008 Sorry.. My question was commented in the script... But basically I want the php script that will generate the link coming from the output in the column. (BTS No.) Quote Link to comment Share on other sites More sharing options...
cuboidgraphix Posted June 19, 2008 Author Share Posted June 19, 2008 ohdang888 ... any help my friend? Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted June 19, 2008 Share Posted June 19, 2008 this sounds like an ajax problem, not php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.