this is my first attempt at creating a php based sql query, so please don't laugh too hard at me..
my table structure is thus:
Code:xdata_data: |---------------------------------------| | field_id | user_id | xdata_value | |---------------------------------------| | 10 | 3 | Lantean | | 11 | 3 | Priest | | 12 | 3 | Knight | | 13 | 3 | 50 | | 14 | 3 | 50 | | 10 | 2 | Izzymage | | 11 | 2 | Mage | | 12 | 2 | Rogue | | 13 | 2 | 42 | | 14 | 2 | 31 | -----------------------------------------
My php is this:
output looks like this:Code:<?php // show all errors while still developing: ini_set('display_errors', 1); error_reporting(E_ALL); // use require instead of include since rest of script depends on this: require 'config.php'; mysql_connect("localhost","$mysql_u","$mysql_p") or die("DB connection failed - " . mysql_error()); mysql_select_db("$mysql_db") or die ("DB select failed - " . mysql_error()); $query = "SELECT data FROM xdata_data WHERE user_id = '*' "; $result = mysql_query($query) or die("Query failed ($query) - " . mysql_error()); if(mysql_num_rows($result)) { while($row = mysql_fetch_assoc($result)) { $data = $row['xdata_value'] ; echo ("$data"); } } else { echo "<p>No matches were found in the database for your query.</p>\n"; } ?>
I want to post the information into tables that resemble this:Code:LanteanPriestKnight5050IzzymageMageScout4231
Code:____________________________________ | Lantean | Priest - Knight | | | 50 - 50 | |----------------------------------| | Izzymage | Mage - Rogue | | | 42 - 31 | |----------------------------------|
How would i go about formating the output like that?
Any help would be most appreciated.
ArcAiN6


Reply With Quote
Bookmarks