ok I am new to databases!! Been using a database for years but I have never really done anything useful with it! I have my call of duty clan site. And I am making a challenge us form. When the form is completed, it puts the info into the database and sends me an email. Thats all perfect.
I found a script that with some changes allowed me to connect to the database and present the information on a webpage. However, it doesn't look all that great. I want to display the information in a table.
Here's the script I'm using........
The HTML part does create the table I want to use. But, am I supposed to use html to display info from a database??Code:<?php $dbhost = 'localhost'; $dbuser = 'database_username'; $dbpass = 'database_password'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'database_name'; mysql_select_db($dbname); $query = "SELECT * FROM challengeus"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "alias :{$row['alias']} <br>" . "xfire : {$row['xfire']} <br>" . "clanwebsite : {$row['clanwebsite']} <br><br>"; } mysql_close($conn); ?> <html> <table border="5" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#808080" width="100%" id="AutoNumber2" bgcolor="#C0C0C0"> <tr> <td width="14%" align="center">Clan</td> <td width="14%" align="center">Clan Website</td> <td width="14%" align="center">Number of Players</td> <td width="14%" align="center">Gametype</td> <td width="14%" align="center">Map</td> <td width="15%" align="center">Date</td> <td width="15%" align="center">Result</td> </tr> <tr> <td width="14%" align="center"> </td> <td width="14%" align="center"><?php {echo "{$row['clanwebsite']}";} ?></td> <td width="14%" align="center"> </td> <td width="14%" align="center"> </td> <td width="14%" align="center"> </td> <td width="15%" align="center"> </td> <td width="15%" align="center"> </td> </tr> </table> </html>
I have no clue as to how to solve this one!!
Thanks in advance to anyone who can help.
Smithster



Reply With Quote
Bookmarks