Jump to content

OsirisElKeleni

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by OsirisElKeleni

  1. Oh thanks alot man! it works fine now really i appriciate it (((: AWESOME FORUM!
  2. Ow yea i did not change the html file to php. :@ But now i'm gettin this error: Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting ',' or ';' in D:\xampp\htdocs\mtgstock\index.php on line 66 this is the full file <!DOCTYPE html> <html> <head> <title>MTG Card List</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css" media="screen"> @import "filtergrid.css"; body{ margin:15px; padding:15px; border:1px solid #666; font-family:Arial, Helvetica, sans-serif; font-size:88%; } h2{ margin-top: 50px; } caption{ margin:10px 0 0 5px; padding:10px; text-align:left; } pre{ font-size:13px; margin:5px; padding:5px; background-color:#f4f4f4; border:1px solid #ccc; } .mytable{ width:100%; font-size:12px; border:1px solid #ccc; } th{ background-color:#003366; color:#FFF; padding:2px; border:1px solid #ccc; } td{ padding:2px; border-bottom:1px solid #ccc; border-right:1px solid #ccc; } body p { font-size: 50%; color: #000; } a:link { color: #000; } a:visited { color: #000; } </style> <script language="javascript" type="text/javascript" src="actb.js"></script> <script language="javascript" type="text/javascript" src="tablefilter.js"></script> </head> <body> <form action="password.php" method="POST"> <b>Username:</b> <input type="text" name="username"> <b>Password:</b> <input type="text" name="password"> <input type="submit"> </form> <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'SELECT `Name`, `Color`, `Type`, `Subtype`, `Power`, `Toughness`, `Manacost`, `Rarity`, `Expansion`, `Foil`, `Stock` FROM `mtgtabel`'; mysql_select_db('mtgstock'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } echo '<table class=mytable>'; echo "<tr><th >Name</th><th >Color</th><th >Type</th><th >Sub Type</th><th >Power</th><th >Toughness</th><th >Converted mana cost</th><th >Rarity</th><th >Expansion</th><th >Foil</th><th >Stock</th></tr>"; while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "<tr><td>"; echo $row['Name'] echo "</td><td>"; echo $row['Color']; echo "</td><td>"; echo $row['Type']; echo "</td><td>"; echo $row['Subtype']; echo "</td><td>"; echo $row['Power']; echo "</td><td>"; echo $row['Toughness']; echo "</td><td>"; echo $row['Manacost']; echo "</td><td>"; echo $row['Rarity']; echo "</td><td>"; echo $row['Expansion']; echo "</td><td>"; echo $row['Foil']; echo "</td><td>"; echo $row['Stock']; echo "</td></tr>"; } echo "</table>"; mysql_close($conn); ?> <script language="javascript" type="text/javascript"> var recapFilters = { sort_select: true, loader: true, col_1: "select", col_2: "select", col_3: "select", col_7: "select", col_8: "select", col_9: "select", col_10: "false", on_change: true, display_all_text: "Show all", rows_counter: true, btn_reset: true, alternate_rows: true, btn_reset_text: "Clear", col_width: ["150px","150px",null,null] } setFilterGrid("recap",recapFilters); </script> <script language="javascript" type="text/javascript"> var table_Props = { paging: true, paging_length: 3, rows_counter: true, btn_reset: true, loader: true, loader_text: "Filtering data..." }; setFilterGrid( "table",table_Props ); </script> </body> </html> >Thanks for responding and helping me out so quickly btw!
  3. Getting no error as far as i can see, it prints the code instead of using it. http://imgur.com/S5wlflW this is the result of that code
  4. Hello everyone, i'm Osiris and i'm stuck with this PHP/HTML code, i'm fairly new at this so this might be a dumb question. i have a database, but i want to output all data into a table from the database using HTML codes. i had it so far that i could outpust the info in just plain text but it doesn't output in the HTML table. Can anyone see what i did wrong? This is my PHP code its in the body section <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'password'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'SELECT `Name`, `Color`, `Type`, `Subtype`, `Power`, `Toughness`, `Manacost`, `Rarity`, `Expansion`, `Foil`, `Stock` FROM `mtgtabel`'; mysql_select_db('mtgstock'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } echo '<table class=mytable>'; echo "<tr><th >Name</th><th >Color</th><th >Type</th><th >Sub Type</th><th >Power</th><th >Toughness</th><th >Converted mana cost</th><th >Rarity</th><th >Expansion</th><th >Foil</th><th >Stock</th></tr>"; while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "<tr><td>"; echo $row['Name'] echo "</td><td>"; echo $row['Color']; echo "</td><td>"; echo $row['Type']; echo "</td><td>"; echo $row['Subtype']; echo "</td><td>"; echo $row['Power']; echo "</td><td>"; echo $row['Toughness']; echo "</td><td>"; echo $row['Manacost']; echo "</td><td>"; echo $row['Rarity']; echo "</td><td>"; echo $row['Expansion']; echo "</td><td>"; echo $row['Foil']; echo "</td><td>"; echo $row['Stock']; echo "</td></tr>"; } echo "</table>"; mysql_close($conn); ?> Thanks in advance!
×
×
  • 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.