Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- {
- $user=$_SESSION['username'];
- $pass=$_SESSION['password'];
- }
- $con = mysql_connect("localhost","****","*****");
- var_dump($con);
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("****", $con);
- $result = mysql_query("select * from `order` WHERE username='$user'");
- while ($row = mysql_fetch_array($result))
- {
- $html_table = '<table border="1 cellspacing="0" cellpadding="2""><th>Company Symbol </th><th>Amount </th><th>Actual Stockprice </th><th>Old Stockprice </th><th>Cost </th><th>Profit/loss </th><tr>';
- foreach($result as $row) {
- $html_table .= '<tr><td>' .$row['company']. '</td><td>' .$row['amount']. '</td><td>' .$row['stock']. '</td></tr>';
- }
- $html_table .= '</tr></table>';
- $html_table = str_replace('<tr></tr>', '', $html_table);
- echo $html_table;
- }
- ?>
- echo '<table border="1" cellspacing="0" cellpadding="2">';
- echo '<th>Company Symbol</th><th>Amount</th><th>Actual Stockprice</th><th>Old Stockprice</th><th>Cost</th><th>Profit loss</th><tr>';
- while ($row = mysql_fetch_array($result)) {
- echo '<tr>';
- foreach($row as $value) {
- echo "<td>$value</td>";
- }
- echo '</tr>';
- }
- echo '</table'>;
- foreach($row as $a_variable_name_that_is_not_result) {
- //stuff
- }
- $html_table = '<table border="1" cellspacing="0" cellpadding="2"><th>Company Symbol </th><th>Amount </th><th>Actual Stockprice </th><th>Old Stockprice </th><th>Cost </th><th>Profit/loss </th><tr>';
- while ($row = mysql_fetch_array($result))
- {
- $html_table .= '<tr><td>' .$row['company']. '</td><td>' .$row['amount']. '</td><td>' .$row['stock']. '</td></tr>';
- }
- $html_table .= '</tr></table>';
- mysql_query("select * from `order` WHERE username='$user'");
- while ($row = mysql_fetch_array($result))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement