paulman888888 Posted August 18, 2009 Share Posted August 18, 2009 Hi; First Off thank-you for reading my post. <? $header_scripts.='<script type=\'text/javascript\' src=\'http://www.google.com/jsapi\'></script> <script type=\'text/javascript\'> google.load(\'visualization\', \'1\', {packages:[\'table\']}); google.setOnLoadCallback(drawTable); function drawTable() { var data = new google.visualization.DataTable(); data.addColumn(\'string\', \'Event Name\'); data.addColumn(\'string\', \'Date\'); data.addColumn(\'string\', \'Postcode\'); data.addColumn(\'string\', \'Distance (From: '.$userpostcode.')\'); data.addColumn(\'string\', \'View More\');'; $query = "SELECT * FROM chess_event "; $result = mysql_query($query)or die(mysql_error()); $i=0; $header_scripts.="\r\n".'data.addRows('.mysql_num_rows($result).');'."\r\n"; while($row = mysql_fetch_array($result)){ $header_scripts.='data.setCell('.$i.', 0, \''.$row['name'].'\');'."\r\n"; $header_scripts.='data.setCell('.$i.', 1, \''.$row['day'].'\');'."\r\n"; $header_scripts.='data.setCell('.$i.', 2, \''.$row['postcode'].');\''."\r\n"; $header_scripts.='data.setCell('.$i.', 3, \''.get_latlong_from_postcodes($userpostcode, $row['postcode']).'\');'."\r\n"; $header_scripts.='data.setCell('.$i.', 4, \'<a href="link">More</a>\');'."\r\n"; $i++; // increment counter } $header_scripts.='var table = new google.visualization.Table(document.getElementById(\'table_div\')); table.draw(data, {showRowNumber: true}); } </script>';$body.='<div id="table_div">Loading! Please Wait...</div>';?> Above is my PHP code Below is the output <script> <script type='text/javascript' src='http://www.google.com/jsapi'></script> <script type='text/javascript'> google.load('visualization', '1', {packages:['table']}); google.setOnLoadCallback(drawTable); function drawTable() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Event Name'); data.addColumn('string', 'Date'); data.addColumn('string', 'Postcode'); data.addColumn('string', 'Distance (From: SW10)'); data.addColumn('string', 'View More'); data.addRows(2); data.setCell(0, 0, 'Test Event 4'); data.setCell(0, 1, '2010-02-15'); data.setCell(0, 2, 'Dn16);' data.setCell(0, 3, '148 miles'); data.setCell(0, 4, '<a href="LINK">More</a>'); data.setCell(1, 0, 'Test Event 3'); data.setCell(1, 1, '2009-01-01'); data.setCell(1, 2, 'Dn16);' data.setCell(1, 3, '148 miles'); data.setCell(1, 4, '<a href="LINK">More</a>'); var table = new google.visualization.Table(document.getElementById('table_div')); table.draw(data, {showRowNumber: true}); } </script> Please Can Someone tell me what i have done wrong. Thank-you All Paul Quote Link to comment Share on other sites More sharing options...
trq Posted August 18, 2009 Share Posted August 18, 2009 You have got to be kidding? You might want to at least describe your problem. Theres a link in my signature (howto ask) in case you need help learning how to ask questions. Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted August 18, 2009 Author Share Posted August 18, 2009 Sorry; your right. Well i have been trying to use Google Visulisation API but its not going very well, i copyed the demo from Google and edited to PHP. It doesn't work at all. I have done everything (that i can think of as well other people ideas) but it just won't work. Thank-you Paul Sorry once again for the 1st bad post, i was so into the ''Zone'' trying to fix the problem. 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.