EG Information
Training Missions
Knowledge Bank
Pimp Us Out!
Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site And Create A Link Back To Enigma Group.
|
| |
Affiliates
|
|
Enigma Group's Code Bank
SQL Table to HTML Table FunctionBy: Teksaid - Date Submitted: 2008-11-20 03:23:51 <?php /****************** * Purpose: Function used to take all the data from a mySQL table * and create a HTML table display the information . * Authoer: Teksaid *******************/ // Parameters: mySQLi Connection Object and name of table to display function htmlTable($connObj, $tableName) { // Query to grab all the table DATA $tableQuery = "SELECT * FROM " . $tableName; // Store the results of the query $tableResults = $connObj->query($tableQuery) or die($connObj->error); // Grab all the column names for the column headers of the HTML table $colNames = $tableResults->fetch_fields(); echo " <table id='{$tableName}' class='dataTable'> <tr colspan='2'>"; // Loop through columns names to create column headers echo "<td>" .$val->name. "</td>"; } // Put results into an array and loop through until the end of the array while($tableArray = $tableResults->fetch_assoc()) { // Loop through columns names to grab each columns corresponding data from results array echo "<td>" .$tableArray[$val->name]. "</td>"; } } } //////////////////////// EXAMPLE ////////////////////// // Creating connection object with mySQL informatoin $connObj = new mysqli('localhost', 'user', 'pass', 'database'); // Calling the output function to display the HTML table // for the table users from the database in the connection object. htmlTable($connObj, 'users'); /////////////////////////////////////////////////////// ?>
|
| Return to
php category list |
|
|
Who Visited EnigmaGroup Today?
1557 Guests, 262 Users (178 Spiders)
learning, aurena, suetekh, Hessesian, Rex_Mundi, st3alth, Partisan, hackaday, K0gller, fitz, 3ntr0py, DrOptix, Jayjay, JohnMalkovitzch, psychomarine, whoami, nmobin27, Vspectrum, lotato, San Marino, TinCardinal, brunoriversyhn, TheHarrisonW, code-g, yshiau, BillTuer, Psiber_Syn, Klosse, Seasharp, whisperer, obencefoozy, SlayingDragons, Link-, tinuigimeni, jasonbourne, Fred, GothicLogic, strudels, somebody777, Meonkzt, CJ_Omaha, jearrorne, cls777, unsugsNashy, Balksnuntails, trueorfalse, Sir D. Naut, zach, batsbargy, Rik, Macabre, ellisp, Nightraven, Iccyx, Repuhlsive, vipervince2002, Janomatrix, lol, veceattainc, techno, Exclaw, limited, Nikhil, evjfvir967nj, blackknight911, Distorted, Mod777, dark_void, nermtode, Tjm, bjy1997, hecky, saraf, elprof, damoniceht, trik, jordan86, SnoopSky, dan_movie, OnetInsolefon, Blavatsky, darkfire1515, seojlhmyrhwh, Thoplehap, MaxMeier, 1028rajeev, Abhinav2107, autotuneuser, riesenjoe, alexelixir, Tauya, Jozinbrejl, kernel_mod, quolc, anandoump, vladavlada, Taicadine, valy1177, AnnaNoult, GreenTiger, baripadatimes, Ewing, Blackbeard, thepuppeteer, BON-SELE, hak4r, Unotohumsmush, NIGHTWOLF, CloverCipher, m4f10, Vengeance987, avacraft, Bumpadjuppy, becool, thecoder, ddxc, n01se, alpha1, saki, ObesseJew, ActictGlync, sajan, unicornrainbow, Domihoolbob, matt.14, max66, SnowFury, Spud101, myfabregas, Ausome1, kajman121, Frudopvia, ideveloper6, OLOLO, Bugshuppy, lamb, VagWirura, LialiTiTviors, Ordeptpen, scifics, Pozycj-Z21, RomeoG, Gkjt, interPuscruse, aaftab, TheCheeseDemon, blackcyxx21, jollyjimbo, N4g4c3N, rineDriekly, Rap70r, Xargos, flarornEral, ovetz13, sonu sahu, Breezy, emitleBen, Hackpad, JWTSR, nicyun, kaizo, itevainee, IvanDimitriev, advilapyday, luke460, AverageJoe, zeratu92, m0rt, litbk, Mr.Pickle, mannavard1611, LoopyLion, NexusVos, lonely.connection, mtroscheck, burberrybagsjr, nikedunksxm, xordux, jeho, Lonewolf034, Dragonite, nhorton, Reloaded, Odile, Kaptain_k1rk, Teefelltugh, grizzly, posthuman01, jakesboy2, pwnpwnlolz, Sabo, Lakhoamnmek, Røgue, dot_Cipher, mori, snickerless1, cart1m, Xendz, KELATALFTUS, hubris, Afrika, welepocourl, carpinteyrofbt, ReottphoffBom, Reahastegah, pumashoesld, pdanielt, dmac006, DnA-Ender, Red Fox, couptupleakb, ryanjcrook, iMaxx, sh3llcod3, TimHortons, EmilaHapsaums, Feld Grau, burgeoningneophyte, Maroonhat, CookieAu, tinkansinar, Mitodina, timberlandoutletlufc, zsefvy, guccioutletox, AlexDiru, AbercrombieFitchhl, Ryuske, r0z4, slchill, rospark, kalak55, Ph4Kt480ii, beefarn, Jigoku, WrossyJes, pollolololo, ZepSung, Fragility, jell0, C9019, Othrguy, Noticon, KIKNWING, llasarus, mdubz, leah027, iellswo, MAZI_, Estilaamoli, subtentar, Trollorful, no, nas0151, Traybo, howisthechicken, thethird3y3, Somethingclever, marplusz, MSI52, twink gay cam dUi8D, temoJessy |
| |
|
|
|
|
|