login  Naam:   Wachtwoord: 
Registreer je!
 Forum

Uit db halen

Offline tomk - 24/09/2005 09:40
Avatar van tomkASP interesse Dag kinderen,

Ik had even een vraag. Ik heb een php script en moet iets uit database halen. dit script:
  1. <?
  2. include("config.php");
  3. ?>
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  7. <title>Main::Carriere-manager.nl</title>
  8. <style type="text/css">
  9. <!--
  10. .style1 {font-size: 12px}
  11. -->
  12. </style>
  13. </head>
  14.  
  15. <body>
  16. <table width="395" height="223">
  17. <tr>
  18. <td width="91"><img src="images/competitielogos/bundesliga.jpg" width="80" height="80"></td>
  19. <td width="96"><img src="images/competitielogos/eredivisie.jpg" width="80" height="80"></td>
  20. <td width="97"><img src="images/competitielogos/primeradivision.jpg" width="80" height="80"></td>
  21. <td width="91"><img src="images/competitielogos/primierleaque.jpg" width="80" height="80"></td>
  22. </tr>
  23. <tr>
  24. <td><span class="style1">Competities: </span></td>
  25. <td><span class="style1">Competities: </span></td>
  26. <td><span class="style1">Competities: </span></td>
  27. <td><span class="style1">Competities: </span></td>
  28. </tr>
  29. <tr>
  30. <td><img src="images/competitielogos/superliga.jpg" width="80" height="80"></td>
  31. <td><img src="images/competitielogos/seriea.jpg" width="80" height="80"></td>
  32. <td><img src="images/competitielogos/JupilerLeague.jpg" width="80" height="80"></td>
  33. <td><font size="2"> <img src="images/competitielogos/mls.jpg" width="80" height="80" border="0"></font></td>
  34. </tr>
  35. <tr>
  36. <td><span class="style1">Competities: </span></td>
  37. <td><span class="style1">Competities: </span></td>
  38. <td><span class="style1">Competities: </span></td>
  39. <td><span class="style1">Competities: </span></td>
  40. </tr>
  41. </table>
  42. <font size="2"><strong>
  43.  
  44. </strong></font>
  45. <p>&nbsp;</p>
  46. </body>
  47. </html>

Hij moet uit de tabel competities halen hoeveel competities in dat land zitten. hier een vb:
http://img357.imageshack.us/img357/3450/zo07kk.jpg

En de tabel zit er zo uit:
  1. CREATE TABLE `competities` (
  2. `bundesliga` int(10) NOT NULL default '0',
  3. `eredivisie` int(10) NOT NULL default '0',
  4. `primeradivision` int(10) NOT NULL default '0',
  5. `primierleaque` int(10) NOT NULL default '0',
  6. `superliga` int(10) NOT NULL default '0',
  7. `seriea` int(10) NOT NULL default '0',
  8. `jupilerleaque` int(10) NOT NULL default '0',
  9. `mls` int(10) NOT NULL default '0'
  10. ) TYPE=MyISAM;


Bedankt voor jullie hulp:)

7 antwoorden

Gesponsorde links
Offline lasdesigner - 24/09/2005 09:42
Avatar van lasdesigner PHP beginner
  1. <?php
  2. $q = mysql_query("SELECT * FROM tabel") or die(mysql_error());
  3. while($a = mysql_fetch_assoc($q))
  4. {
  5. echo $a['primeradvision'];
  6. }
  7. ?>

Ik heb maar een voorbeeldje genomen
Offline tomk - 24/09/2005 09:54
Avatar van tomk ASP interesse komt niks te staan:s
Offline lasdesigner - 24/09/2005 10:03
Avatar van lasdesigner PHP beginner Heb je wel tabel veranderd? In jou tabelnaam?
Offline tomk - 24/09/2005 10:06
Avatar van tomk ASP interesse ja.

Kijkl heb hem zo:
  1. <?
  2. include("config.php");
  3. ?>
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  7. <title>Main::Carriere-manager.nl</title>
  8. <style type="text/css">
  9. <!--
  10. .style1 {font-size: 12px}
  11. -->
  12. </style>
  13. </head>
  14.  
  15. <body>
  16. <?php
  17. $q = mysql_query("SELECT * FROM competities") or die(mysql_error());
  18. while($a = mysql_fetch_assoc($q))
  19. {
  20. echo $a['primeradvision'];
  21. }
  22. ?><table width="395" height="223">
  23. <tr>
  24. <td width="91"><img src="images/competitielogos/bundesliga.jpg" width="80" height="80"></td>
  25. <td width="96"><img src="images/competitielogos/eredivisie.jpg" width="80" height="80"></td>
  26. <td width="97"><img src="images/competitielogos/primeradivision.jpg" width="80" height="80"></td>
  27. <td width="91"><img src="images/competitielogos/primierleaque.jpg" width="80" height="80"></td>
  28. </tr>
  29. <tr>
  30. <td><span class="style1">Competities: </span></td>
  31. <td><span class="style1">Competities: </span></td>
  32. <td><span class="style1">Competities: </span></td>
  33. <td><span class="style1">Competities: </span></td>
  34. </tr>
  35. <tr>
  36. <td><img src="images/competitielogos/superliga.jpg" width="80" height="80"></td>
  37. <td><img src="images/competitielogos/seriea.jpg" width="80" height="80"></td>
  38. <td><img src="images/competitielogos/JupilerLeague.jpg" width="80" height="80"></td>
  39. <td><font size="2"> <img src="images/competitielogos/mls.jpg" width="80" height="80" border="0"></font></td>
  40. </tr>
  41. <tr>
  42. <td><span class="style1">Competities: </span></td>
  43. <td><span class="style1">Competities: </span></td>
  44. <td><span class="style1">Competities:</span></td>
  45. <td><span class="style1">Competities: </span></td>
  46. </tr>
  47. </table>
  48. <font size="2"><strong>
  49.  
  50. </strong></font>
  51. <p>&nbsp;</p>
  52. </body>
  53. </html>
Offline lasdesigner - 24/09/2005 10:15
Avatar van lasdesigner PHP beginner staat er wel wat in de database? Of is die leeg?
Offline marten - 24/09/2005 10:24 (laatste wijziging 24/09/2005 10:26)
Avatar van marten Beheerder Misschien is het ook handig om vervolgens bij je kolom competities
het resultaat uit te lezen? 

<td><span class="style1">Competities: <? echo "$a->primeradvision" ?></span></td>
Offline Rens - 24/09/2005 12:07
Avatar van Rens Gouden medaille

Crew algemeen
$a['primeradvision'] staat er in je script, en in je tabel staat primeradivision...
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2025 Sitemasters.be - Regels - Laadtijd: 0.211s