Jump to content

BarryT06

Members
  • Posts

    14
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

BarryT06's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. @Psycho - Wow! Thanks! This has definitely got me started. Sorry I didnt respond to your original post, I posted this on my work PC and never thought of checking when I was home last night. Its not 100% but its a serious jump start considering where I was with it yesterday! Thank you very much!
  2. Hi, I am building a dashboard/report in work and I have it working at present (not fully) but I made the table structure static, in that if I wanted to make another one for another part of the business, I would need to redo the html table structure. I want to have it create the table itself based on the information in the array. I have included a sample of $data_array and also a screenshot of the current layout I have aswell as a sample of the HTML that is currently in use to generate the below table. I understand its probably going to be a loop job, however Im getting confused as normally you loop for each row, but in this case I need to loop for each TD. If there is any furthe info I can provide that would help, please let me know. Apologies if I have not explained what I am looking for very well. <table border="1" bordercolor="#000000" style="background-color:#FFFFFF" width="100%" cellpadding="3" cellspacing="0"> <tr> <td colspan="3" rowspan="3" class="unused"></td> <td class = "center main_heading" colspan="33">UK Retail</td> </tr> <tr> <td class = "center channel_heading" colspan="<?php echo $chat_width;?>" ><a href="uk_retail_hh.php?c=Chat">Chat</a></td> <td class = "center channel_heading" colspan="<?php echo $phone_width;?>"><a href="uk_retail_hh.php?c=Phone">Phone</a></td> <td class = "center channel_heading" colspan="<?php echo $email_width;?>"><a href="uk_retail_hh.php?c=Email">Email</a></td> </tr> <tr> <td class = "center site_heading chat_ORK" >ORK</td> <td class = "center site_heading chat_EDI" >EDI</td> <td class = "center site_heading chat_VCC" >VCC</td> <td class = "center site_heading chat_HYD" >HYD</td> <td class = "center site_heading chat_BCD" >BCD</td> <td class = "center site_heading chat_SUT" >SUT</td> <td class = "center site_heading" >ORK</td> <td class = "center site_heading" >EDI</td> <td class = "center site_heading" >VCC</td> <td class = "center site_heading" >CBU</td> <td class = "center site_heading" >CPT</td> <td class = "center site_heading" >DAK</td> <td class = "center site_heading" >JAM</td> <td class = "center site_heading" >MNL</td> <td class = "center site_heading" >ORK</td> <td class = "center site_heading" >EDI</td> <td class = "center site_heading" >VCC</td> <td class = "center site_heading" >HYD</td> <td class = "center site_heading" >BCD</td> <td class = "center site_heading" >SUT</td> <td class = "center site_heading" >DAK</td> </tr> <tr> <td colspan="3">Offered</td> <td class = "center Chat_ORK"><?php echo $data_array['Chat']['ORK1']['Incoming'] ?></td> <td class = "center Chat_EDI"><?php echo $data_array['Chat']['EDI3']['Incoming'] ?></td> <td class = "center Chat_VCC"><?php echo $data_array['Chat']['UKVCC']['Incoming'] ?></td> <td class = "center Chat_HYD"><?php echo $data_array['Chat']['HYD']['Incoming'] ?></td> <td class = "center Chat_BCD"><?php echo $data_array['Chat']['BCD']['Incoming'] ?></td> <td class = "center Chat_SUT"><?php echo $data_array['Chat']['SUT']['Incoming'] ?></td> <td class = "center Phone_ORK"><?php echo $data_array['Phone']['ORK1']['Incoming'] ?></td> <td class = "center Phone_EDI"><?php echo $data_array['Phone']['EDI3']['Incoming'] ?></td> <td class = "center Phone_VCC"><?php echo $data_array['Phone']['UKVCC']['Incoming'] ?></td> <td class = "center Phone_CBU"><?php echo $data_array['Phone']['CBU1']['Incoming'] ?></td> <td class = "center Phone_CPT"><?php echo $data_array['Phone']['CPT']['Incoming'] ?></td> <td class = "center Phone_DAK"><?php echo $data_array['Phone']['DAK']['Incoming'] ?></td> <td class = "center Phone_JAM"><?php echo $data_array['Phone']['JAM']['Incoming'] ?></td> <td class = "center Phone_MNL"><?php echo $data_array['Phone']['MNL']['Incoming'] ?></td> <td class = "center Email_ORK"><?php echo $data_array['Email']['ORK1']['Incoming'] ?></td> <td class = "center Email_EDI"><?php echo $data_array['Email']['EDI3']['Incoming'] ?></td> <td class = "center Email_VCC"><?php echo $data_array['Email']['UKVCC']['Incoming'] ?></td> <td class = "center Email_HYD"><?php echo $data_array['Email']['HYD']['Incoming'] ?></td> <td class = "center Email_BCD"><?php echo $data_array['Email']['BCD']['Incoming'] ?></td> <td class = "center Email_SUT"><?php echo $data_array['Email']['SUT']['Incoming'] ?></td> <td class = "center Email_DAK"><?php echo $data_array['Email']['DAK']['Incoming'] ?></td> </tr> <tr> <td colspan="3">Handled</td> <td class = "center Chat_ORK"><?php echo $data_array['Chat']['ORK1']['Handled_incoming'] ?></td> <td class = "center Chat_EDI"><?php echo $data_array['Chat']['EDI3']['Handled_incoming'] ?></td> <td class = "center Chat_VCC"><?php echo $data_array['Chat']['UKVCC']['Handled_incoming'] ?></td> <td class = "center Chat_HYD"><?php echo $data_array['Chat']['HYD']['Handled_incoming'] ?></td> <td class = "center Chat_BCD"><?php echo $data_array['Chat']['BCD']['Handled_incoming'] ?></td> <td class = "center Chat_SUT"><?php echo $data_array['Chat']['SUT']['Handled_incoming'] ?></td> <td class = "center Phone_ORK"><?php echo $data_array['Phone']['ORK1']['Handled_incoming'] ?></td> <td class = "center Phone_EDI"><?php echo $data_array['Phone']['EDI3']['Handled_incoming'] ?></td> <td class = "center Phone_VCC"><?php echo $data_array['Phone']['UKVCC']['Handled_incoming'] ?></td> <td class = "center Phone_CBU"><?php echo $data_array['Phone']['CBU1']['Handled_incoming'] ?></td> <td class = "center Phone_CPT"><?php echo $data_array['Phone']['CPT']['Handled_incoming'] ?></td> <td class = "center Phone_DAK"><?php echo $data_array['Phone']['DAK']['Handled_incoming'] ?></td> <td class = "center Phone_JAM"><?php echo $data_array['Phone']['JAM']['Handled_incoming'] ?></td> <td class = "center Phone_MNL"><?php echo $data_array['Phone']['MNL']['Handled_incoming'] ?></td> <td class = "center Email_ORK"><?php echo $data_array['Email']['ORK1']['Handled_incoming'] ?></td> <td class = "center Email_EDI"><?php echo $data_array['Email']['EDI3']['Handled_incoming'] ?></td> <td class = "center Email_VCC"><?php echo $data_array['Email']['UKVCC']['Handled_incoming'] ?></td> <td class = "center Email_HYD"><?php echo $data_array['Email']['HYD']['Handled_incoming'] ?></td> <td class = "center Email_BCD"><?php echo $data_array['Email']['BCD']['Handled_incoming'] ?></td> <td class = "center Email_SUT"><?php echo $data_array['Email']['SUT']['Handled_incoming'] ?></td> <td class = "center Email_DAK"><?php echo $data_array['Email']['DAK']['Handled_incoming'] ?></td> </tr> Array ( [Phone] => Array ( [CBU1] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => CBU1 [phone_skill] => Primary [OU] => UK [Incoming] => 1005 [Handled_incoming] => 902 [Aband_6] => 39 [Aband_210] => 39 [Aband_30] => 32 [Ans_60sec] => 810 [Ans_210sec] => 966 [Ans_30sec] => 683 [SL_60] => 0.8448 [SL_210] => 1.0000 [SL_30] => 0.7114 ) [DAK] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => DAK [phone_skill] => Primary [OU] => UK [Incoming] => 913 [Handled_incoming] => 876 [Aband_6] => 18 [Aband_210] => 18 [Aband_30] => 14 [Ans_60sec] => 807 [Ans_210sec] => 894 [Ans_30sec] => 730 [SL_60] => 0.9036 [SL_210] => 0.9989 [SL_30] => 0.8149 ) [JAM] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => JAM [phone_skill] => Primary [OU] => UK [Incoming] => 1171 [Handled_incoming] => 1377 [Aband_6] => 15 [Aband_210] => 15 [Aband_30] => 12 [Ans_60sec] => 1147 [Ans_210sec] => 1155 [Ans_30sec] => 1123 [SL_60] => 0.9923 [SL_210] => 0.9991 [SL_30] => 0.9693 ) [MNL] => Array ( [statistic_date] => 2013-05-20 [time] => 530 [site] => MNL [phone_skill] => Primary [OU] => UK [Incoming] => 1918 [Handled_incoming] => 1764 [Aband_6] => 24 [Aband_210] => 27 [Aband_30] => 16 [Ans_60sec] => 1711 [Ans_210sec] => 1891 [Ans_30sec] => 1459 [SL_60] => 0.9046 [SL_210] => 1.0000 [SL_30] => 0.7690 ) [ORK1] => Array ( [statistic_date] => 2013-05-20 [time] => 700 [site] => ORK1 [phone_skill] => Primary [OU] => UK [Incoming] => 133 [Handled_incoming] => 128 [Aband_6] => 3 [Aband_210] => 3 [Aband_30] => 2 [Ans_60sec] => 96 [Ans_210sec] => 130 [Ans_30sec] => 86 [SL_60] => 0.7444 [SL_210] => 1.0000 [SL_30] => 0.6617 ) [UKVCC] => Array ( [statistic_date] => 2013-05-20 [time] => 700 [site] => UKVCC [phone_skill] => CsPromotions [OU] => UK [Incoming] => 1264 [Handled_incoming] => 1191 [Aband_6] => 28 [Aband_210] => 30 [Aband_30] => 27 [Ans_60sec] => 1133 [Ans_210sec] => 1234 [Ans_30sec] => 1047 [SL_60] => 0.9185 [SL_210] => 1.0000 [SL_30] => 0.8497 ) [CPT] => Array ( [statistic_date] => 2013-05-20 [time] => 800 [site] => CPT [phone_skill] => Primary [OU] => UK [Incoming] => 624 [Handled_incoming] => 624 [Aband_6] => 16 [Aband_210] => 16 [Aband_30] => 13 [Ans_60sec] => 562 [Ans_210sec] => 608 [Ans_30sec] => 535 [SL_60] => 0.9263 [SL_210] => 1.0000 [SL_30] => 0.8782 ) [EDI3] => Array ( [statistic_date] => 2013-05-20 [time] => 900 [site] => EDI3 [phone_skill] => Primary [OU] => UK [Incoming] => 779 [Handled_incoming] => 775 [Aband_6] => 21 [Aband_210] => 22 [Aband_30] => 19 [Ans_60sec] => 724 [Ans_210sec] => 757 [Ans_30sec] => 708 [SL_60] => 0.9564 [SL_210] => 1.0000 [SL_30] => 0.9332 ) ) [Chat] => Array ( [BCD] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => BCD [phone_skill] => PrimaryChat [OU] => UK [Incoming] => 809 [Handled_incoming] => 777 [Aband_6] => 10 [Aband_210] => 11 [Aband_30] => 8 [Ans_60sec] => 765 [Ans_210sec] => 798 [Ans_30sec] => 687 [SL_60] => 0.9580 [SL_210] => 1.0000 [SL_30] => 0.8591 ) [HYD] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => HYD [phone_skill] => PrimaryChat [OU] => UK [Incoming] => 862 [Handled_incoming] => 954 [Aband_6] => 8 [Aband_210] => 10 [Aband_30] => 8 [Ans_60sec] => 818 [Ans_210sec] => 852 [Ans_30sec] => 765 [SL_60] => 0.9582 [SL_210] => 1.0000 [SL_30] => 0.8968 ) [ORK1] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => ORK1 [phone_skill] => PrimaryChat [OU] => UK [Incoming] => 314 [Handled_incoming] => 317 [Aband_6] => 3 [Aband_210] => 3 [Aband_30] => 3 [Ans_60sec] => 311 [Ans_210sec] => 311 [Ans_30sec] => 290 [SL_60] => 1.0000 [SL_210] => 1.0000 [SL_30] => 0.9331 ) [SUT] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => SUT [phone_skill] => PrimaryChat [OU] => UK [Incoming] => 1369 [Handled_incoming] => 1234 [Aband_6] => 21 [Aband_210] => 22 [Aband_30] => 19 [Ans_60sec] => 1299 [Ans_210sec] => 1347 [Ans_30sec] => 1181 [SL_60] => 0.9642 [SL_210] => 1.0000 [SL_30] => 0.8766 ) [UKVCC] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => UKVCC [phone_skill] => PrimaryChat [OU] => UK [Incoming] => 300 [Handled_incoming] => 300 [Aband_6] => 2 [Aband_210] => 2 [Aband_30] => 2 [Ans_60sec] => 298 [Ans_210sec] => 298 [Ans_30sec] => 263 [SL_60] => 1.0000 [SL_210] => 1.0000 [SL_30] => 0.8833 ) [EDI3] => Array ( [statistic_date] => 2013-05-20 [time] => 900 [site] => EDI3 [phone_skill] => PrimaryChat [OU] => UK [Incoming] => 273 [Handled_incoming] => 296 [Aband_6] => 2 [Aband_210] => 2 [Aband_30] => 2 [Ans_60sec] => 269 [Ans_210sec] => 271 [Ans_30sec] => 251 [SL_60] => 0.9927 [SL_210] => 1.0000 [SL_30] => 0.9267 ) ) [Email] => Array ( [BCD] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => BCD [phone_skill] => RetailEmail [OU] => UK [Incoming] => 1309 [Handled_incoming] => 1293 [Aband_6] => 0 [Aband_210] => 0 [Aband_30] => 0 [Ans_60sec] => 0 [Ans_210sec] => 0 [Ans_30sec] => 0 [SL_60] => 0.0000 [SL_210] => 0.0000 [SL_30] => 0.0000 ) [CPT] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => CPT [phone_skill] => CsPromotionsEmail [OU] => UK [Incoming] => 15 [Handled_incoming] => 49 [Aband_6] => 0 [Aband_210] => 0 [Aband_30] => 0 [Ans_60sec] => 0 [Ans_210sec] => 0 [Ans_30sec] => 0 [SL_60] => 0.0000 [SL_210] => 0.0000 [SL_30] => 0.0000 ) [DAK] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => DAK [phone_skill] => Email [OU] => UK [Incoming] => 1081 [Handled_incoming] => 1129 [Aband_6] => 0 [Aband_210] => 0 [Aband_30] => 0 [Ans_60sec] => 0 [Ans_210sec] => 0 [Ans_30sec] => 0 [SL_60] => 0.0000 [SL_210] => 0.0000 [SL_30] => 0.0000 ) [EDI3] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => EDI3 [phone_skill] => Email [OU] => UK [Incoming] => 709 [Handled_incoming] => 754 [Aband_6] => 0 [Aband_210] => 0 [Aband_30] => 0 [Ans_60sec] => 0 [Ans_210sec] => 0 [Ans_30sec] => 0 [SL_60] => 0.0000 [SL_210] => 0.0000 [SL_30] => 0.0000 ) [HYD] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => HYD [phone_skill] => RetailEmail [OU] => UK [Incoming] => 2012 [Handled_incoming] => 1766 [Aband_6] => 0 [Aband_210] => 0 [Aband_30] => 0 [Ans_60sec] => 0 [Ans_210sec] => 0 [Ans_30sec] => 0 [SL_60] => 0.0000 [SL_210] => 0.0000 [SL_30] => 0.0000 ) [ORK1] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => ORK1 [phone_skill] => Email [OU] => UK [Incoming] => 1320 [Handled_incoming] => 336 [Aband_6] => 0 [Aband_210] => 0 [Aband_30] => 0 [Ans_60sec] => 0 [Ans_210sec] => 0 [Ans_30sec] => 0 [SL_60] => 0.0000 [SL_210] => 0.0000 [SL_30] => 0.0000 ) [SUT] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => SUT [phone_skill] => CarriersEmail [OU] => UK [Incoming] => 3785 [Handled_incoming] => 3704 [Aband_6] => 0 [Aband_210] => 0 [Aband_30] => 0 [Ans_60sec] => 0 [Ans_210sec] => 0 [Ans_30sec] => 0 [SL_60] => 0.0000 [SL_210] => 0.0000 [SL_30] => 0.0000 ) [UKVCC] => Array ( [statistic_date] => 2013-05-20 [time] => 0 [site] => UKVCC [phone_skill] => CarriersEmail [OU] => UK [Incoming] => 746 [Handled_incoming] => 750 [Aband_6] => 0 [Aband_210] => 0 [Aband_30] => 0 [Ans_60sec] => 0 [Ans_210sec] => 0 [Ans_30sec] => 0 [SL_60] => 0.0000 [SL_210] => 0.0000 [SL_30] => 0.0000 ) ) )
  3. As far as I know there is not, as the array will index each value, starting at 0. In your case you are making the reference which the array will make anyway. Maybe a more experience designer can point out if I am wrong here.
  4. HI, From what I could tell there wasn't any other changes neccessary. Could you echo out your $sql variable onto your page? It will print exactly what it is sending to the DB. Copy the query it echoes and run it through PHPMyAdmin to see if it works there. I should add that I tried this with your code above and it worked once I added that line of code. I just had a different table_name and field_name, but everything else remained the same. EDIT: I tried the code you posted just there now and it works for me. Just had to change the DB details.
  5. Your just missing one piece. $result = mysql_query($sql); Just like this. <?php $character_set_array = array( ); $character_set_array[ ] = array( 'count' => 5, 'characters' => 'abcdefghijklmnopqrstuvwxyz' ); $character_set_array[ ] = array( 'count' => 1, 'characters' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ); $character_set_array[ ] = array( 'count' => 1, 'characters' => '0123456789' ); $character_set_array[ ] = array( 'count' => 1, 'characters' => '!@#$+-*&?:' ); $temp_array = array( ); foreach ( $character_set_array as $character_set ) { for ( $i = 0; $i < $character_set[ 'count' ]; $i++ ) { $temp_array[ ] = $character_set[ 'characters' ][ rand( 0, strlen( $character_set[ 'characters' ] ) - 1 ) ]; } } shuffle($temp_array); $output=implode($temp_array); echo "<b><b><P ALIGN=Center>$output</P></b></b>"; //this is where the code stores the output in the database $host="localhost"; // Host name $username="computat_xyz"; // Mysql username $password="1234"; // Mysql password $db_name="computat_pqr"; // Database name // Connect to server and select database. $handle = mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db($db_name,$handle)or die("cannot select DB"); $sql="INSERT INTO registration (CompletionCode) VALUES ('$output')"; $result = mysql_query($sql); mysql_close($handle); ?> Barry
  6. @Barand Hey, could u explain a little about how that works? I wasnt aware you could do that, then again Im not exactly an expert, just someone wanting to learn more. @nicse4 you might need to check the type though before using that file, as some of the 'type' field info has 1 piece of info and others have two. ie. fire, ground, or Water Poison, etc and you may need to keep these in the same DB field.
  7. If you want to be able to import this into your DB you are going to need to format the file. I have made a start and done a lot of it, you will need to clear the <span class="pki" rel="pkiAll n7"></span> and the <a href="http://pokemondb.net/pokedex/squirtle" title="View pokedex for #007 Squirtle"> follow the format I have for the first 6 and you should be able to import through phpMyAdmin or through a PHP page using mysql_query and LOAD DATA command. Barry 18463_.php
  8. OK, so did you just go to that page, view source and copy the table contents? I thought they provided you with a source file. If this is the only way you can get the data, I'm not sure I can be of much help. I suppose you could use find and replace to clear out all the table tags and then you would be left with raw data but you would have to comma seperate everything. If you did that you could then import to MySQL through PHP.
  9. either or both, just want to see the format it comes in, to see if i can automate it.
  10. Can you post a sample of the source in its current format?
  11. If you have the information in a file you could format it and then import it to your MySQl DB. Once in there u can build your table from it, or populate an array. Importing will allow u take that buig chunk of data and save it in the DB without having to manually type a load of stuff
  12. Hi, Not entirely sure how your getting the data, as in if you are getting a feed of it, or whether you type it out yourself. I think the best way to do that is input the data into a DB or Array, and build the table from the DB or Array. Barry
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.